From 4ec5c97758869c57c2b22edb9fc9d230460413a8 Mon Sep 17 00:00:00 2001 From: Jakub Rusz Date: Tue, 30 Aug 2022 13:19:39 +0200 Subject: [PATCH] Add Schutzbot and Sonarqube This adds the ability to use our Schutzbot Gitlab CI and run Sonarqube scan there. We have pretty much the exact same thing in weldr-client repo and use it only for Sonarqube. This could also be used in the future if there is any need to use our own CI. The added scan is just informative and is by no means supposed to be used to gate PRs, there will be just one more link to check the results in case anyone is interested. --- .github/workflows/trigger-gitlab.yml | 33 ++++++++++++++++++++++++++ .gitlab-ci.yml | 34 +++++++++++++++++++++++++++ schutzbot/RH-IT-Root-CA.keystore | Bin 0 -> 1447 bytes schutzbot/sonarqube.sh | 30 +++++++++++++++++++++++ schutzbot/terraform | 1 + schutzbot/update_github_status.sh | 29 +++++++++++++++++++++++ 6 files changed, 127 insertions(+) create mode 100644 .github/workflows/trigger-gitlab.yml create mode 100644 .gitlab-ci.yml create mode 100644 schutzbot/RH-IT-Root-CA.keystore create mode 100755 schutzbot/sonarqube.sh create mode 100644 schutzbot/terraform create mode 100755 schutzbot/update_github_status.sh diff --git a/.github/workflows/trigger-gitlab.yml b/.github/workflows/trigger-gitlab.yml new file mode 100644 index 00000000..6ad78a04 --- /dev/null +++ b/.github/workflows/trigger-gitlab.yml @@ -0,0 +1,33 @@ +# inspired by rhinstaller/anaconda + +name: Trigger GitLab CI + +on: + push: + branches: + - main + +jobs: + trigger-gitlab: + runs-on: ubuntu-latest + env: + IMAGEBUILDER_BOT_GITLAB_SSH_KEY: ${{ secrets.IMAGEBUILDER_BOT_GITLAB_SSH_KEY }} + steps: + - name: Install Dependencies + run: | + sudo apt install -y jq + + - name: Clone repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Push to gitlab + run: | + mkdir -p ~/.ssh + echo "${IMAGEBUILDER_BOT_GITLAB_SSH_KEY}" > ~/.ssh/id_rsa + chmod 400 ~/.ssh/id_rsa + touch ~/.ssh/known_hosts + ssh-keyscan -t rsa gitlab.com >> ~/.ssh/known_hosts + git remote add ci git@gitlab.com:redhat/services/products/image-builder/ci/image-builder-frontend.git + git push -f ci diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 00000000..f6457f7d --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,34 @@ +stages: + - init + - test + - finish + +.terraform: + after_script: + - schutzbot/update_github_status.sh update + tags: + - terraform + +init: + stage: init + tags: + - shell + script: + - schutzbot/update_github_status.sh start + +SonarQube: + stage: test + extends: .terraform + script: + - schutzbot/sonarqube.sh + variables: + RUNNER: aws/centos-stream-8-x86_64 + INTERNAL_NETWORK: "true" + GIT_DEPTH: 0 + +finish: + stage: finish + tags: + - shell + script: + - schutzbot/update_github_status.sh finish diff --git a/schutzbot/RH-IT-Root-CA.keystore b/schutzbot/RH-IT-Root-CA.keystore new file mode 100644 index 0000000000000000000000000000000000000000..f6a60adbfb76ee2fb1ccb7cd75cbb7ea86349b9b GIT binary patch literal 1447 zcmV;Y1z7qpf(4@j0Ru3C1zZLRDuzgg_YDCD0ic2fO$34kNic#1MKFQ|K?VsbhDe6@ z4FLxRpn?T5FoFdx0s#Opf(0iA2`Yw2hW8Bt2LUi<1_>&LNQU+thDZTr0|Wso1Q1#MI&OVhPpW79tvl8OI8gW?@5qC48mbvr|fu*|S988~Nk+*5tBWJ}wsHRLfm?mjY zk>qr&au3L3dfdHn91KCl7aR=k3*@dc_H+|q z+k2NQ^TYId5H8F#lhw_%crL=8f84FaVk*;qdK$;bvVl%gn;wY$X`*UoWB$KJpVm?? z5Janvq~OFJICyM?i7t1kCSS>SinW;+h9rT&h%ZuviUl99Ir$k;XifhZGbYB0q{W!x z__zQyu7nDS#D zHwBI(tUSrS>(eFF#I8h@x3*i1R>vs>`*mWJUlcbzjJ(*HNPHy*_^>O{#f7B+&;nij z#Xx?{r~@H2PD_?CIoiaaM#k?f6du(VRzv^qK(TCpu8(;DlN_L~Xd3L`Gs&*t7{YR5&fzsz;IJOlT28CD(l;T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