From baec5970e54f9910bb16eed1e4484eb2aa9b8d42 Mon Sep 17 00:00:00 2001 From: Danny Massa Date: Tue, 16 Feb 2021 17:10:27 +0000 Subject: [PATCH] feat(CI) optional gating This change adds two repositories intended to be used as templates to the Gerrit setup. One repository will utilize the 'Verified' label, one repository will not. This will divide the repositories into two groups, a group where the checks provided by Jarvis is enforced as CI, and a group where the checks provided by Jarvis are informational only, and do not block patch sets. This is configurable in the Jarvis-Project Helm chart. Change-Id: Iff8a2b1a29883837ac7dab49056fe0c64d675e10 --- .../jarvis-project/templates/Job-project.yaml | 16 ++++-- charts/jarvis-project/values.yaml | 2 + tools/gate/jarvis/500-deploy-gerrit.sh | 36 +++++++++---- .../gate/jarvis/800-deploy-jarvis-projects.sh | 50 ++++++++++++++++--- 4 files changed, 82 insertions(+), 22 deletions(-) diff --git a/charts/jarvis-project/templates/Job-project.yaml b/charts/jarvis-project/templates/Job-project.yaml index 75679d5b..b1fd4b50 100644 --- a/charts/jarvis-project/templates/Job-project.yaml +++ b/charts/jarvis-project/templates/Job-project.yaml @@ -40,10 +40,20 @@ spec: - sh - -cex - | - # Create gerrit repo - ssh -oStrictHostKeyChecking=accept-new -oUserKnownHostsFile=/dev/null -p 29418 -i /run/jarvis/secret/gerrit-ssh-key "${GERRIT_USERNAME}@${GERRIT_HOST}" gerrit ls-projects -r "^$JARVIS_PROJECT_NAME\$" | grep -q "^${JARVIS_PROJECT_NAME}\$" || \ - ssh -oStrictHostKeyChecking=accept-new -oUserKnownHostsFile=/dev/null -p 29418 -i /run/jarvis/secret/gerrit-ssh-key ${GERRIT_USERNAME}@${GERRIT_HOST} gerrit create-project "${JARVIS_PROJECT_NAME}" --submit-type MERGE_IF_NECESSARY --owner Administrators --empty-commit + ssh -oStrictHostKeyChecking=accept-new -oUserKnownHostsFile=/dev/null \ + -p 29418 \ + -i /run/jarvis/secret/gerrit-ssh-key "${GERRIT_USERNAME}@${GERRIT_HOST}" \ + gerrit ls-projects -r "^$JARVIS_PROJECT_NAME\$" | grep -q "^${JARVIS_PROJECT_NAME}\$" \ + || \ + ssh -oStrictHostKeyChecking=accept-new -oUserKnownHostsFile=/dev/null \ + -p 29418 \ + -i /run/jarvis/secret/gerrit-ssh-key ${GERRIT_USERNAME}@${GERRIT_HOST} \ + gerrit create-project "${JARVIS_PROJECT_NAME}" \ + --owner Administrators \ + {{ if eq $.Values.config.ci.verify true }} --parent Verified-Label-Projects {{ else }} --parent Non-Verified-Label-Projects {{ end }} \ + --submit-type MERGE_IF_NECESSARY \ + --empty-commit # Set up checks on the repo jarvis-connector --auth_file /run/jarvis/gerrit-authfile --gerrit $GERRIT_URL --update --repo "${JARVIS_PROJECT_NAME}" --prefix jarvispipeline || \ diff --git a/charts/jarvis-project/values.yaml b/charts/jarvis-project/values.yaml index 73f7091a..4d9c9f17 100644 --- a/charts/jarvis-project/values.yaml +++ b/charts/jarvis-project/values.yaml @@ -35,6 +35,8 @@ params: kind: ClusterIssuer config: + ci: + verify: true test: ldap_username: jarvis ldap_password: password diff --git a/tools/gate/jarvis/500-deploy-gerrit.sh b/tools/gate/jarvis/500-deploy-gerrit.sh index 26a97e06..62256ea9 100755 --- a/tools/gate/jarvis/500-deploy-gerrit.sh +++ b/tools/gate/jarvis/500-deploy-gerrit.sh @@ -127,17 +127,6 @@ function gerrit_bootstrap() { git fetch origin refs/meta/config:refs/remotes/origin/meta/config git checkout meta/config - # Configure Verified Label - tee --append project.config <