#58 Skip deployment to prod if pipeline deployment is frozen
Merged 4 years ago by mkovarik. Opened 4 years ago by mkovarik.
mkovarik/c3i-library C3I-68  into  master

@@ -29,6 +29,9 @@ 

  # Path to Jenkinsfile snippet for integration tests used by promotion workflow

  c3i_integration_test_snippet:

  

+ # list of flags in semaphore to allow prod promotion

+ c3i_semaphore_custom_flags: []

+ 

  c3i_definition_dir: openshift/pipelines

  c3i_definition_update_script: ansible-playbook deploy.yml -e c3i_skip_service_accounts=true

  
@@ -59,6 +62,10 @@ 

  c3i_messaging_greenwave_topic_virtualtopic_part: "VirtualTopic.eng.greenwave.decision.update"

  c3i_messaging_repotracker_topic_virtualtopic_part: "VirtualTopic.eng.repotracker.container.tag.>"

  

+ c3i_semaphore_default_flags:

+   - deployments-allowed

+ c3i_semaphore_flags: "{{ c3i_semaphore_default_flags + c3i_semaphore_custom_flags }}"

+ 

  c3i_dev_image_tag: "latest"

  

  c3i_lib_branch: master

@@ -30,7 +30,27 @@ 

      )

    }

    stages {

+     stage("Check semaphore") {

+       steps {

+         script {

+           if (env.SEMAPHORE_CHECK == 'True') {

+             if (c3i.checkSemaphore(env.SEMAPHORE_FLAGS.split(' '))) {

+               env.ALLOW_DEPLOYMENT = "true"

+             }

+             else {

+               currentBuild.displayName = "Skipped"

+             }

+           }

+           else {

+             env.ALLOW_DEPLOYMENT = "true"

+           }

+         }

+       }

+     }

      stage("Message Check and setup") {

+       when {

+          expression { env.ALLOW_DEPLOYMENT }

+       }

        steps {

          script {

            if (params.CI_MESSAGE) {
@@ -92,6 +112,9 @@ 

        }

      }

      stage('Copy image') {

+       when {

+          expression { env.ALLOW_DEPLOYMENT }

+       }

        steps {

          echo "Copy container image ${env.IMAGE} to ${env.PROMOTING_DESTINATION}:${env.TARGET_TAG}"

          retry(5) {

@@ -39,6 +39,10 @@ 

          value: {{ c3i_messaging_topic_consumer_part }}.c3i-{{ item }}-{{ job_vars.name_post }}{{ c3i_test_subscriber }}.{{ c3i_messaging_greenwave_topic_virtualtopic_part }}

        - name: MAIL_ADDRESS

          value: {{ c3i_mail_address }}

+       - name: SEMAPHORE_CHECK

+         value: "{{ job_vars.semaphore_check }}"

+       - name: SEMAPHORE_FLAGS

+         value: {{ c3i_semaphore_flags | join(' ') }}

        # CI_MESSAGE and MESSAGE_HEADERS are used internally by JMS messaging plugin

        - name: CI_MESSAGE

        - name: MESSAGE_HEADERS

@@ -5,3 +5,4 @@ 

  target_tag: prod

  promoting_destination_prefix: "{{ c3i_quay_address }}/{{ c3i_quay_namespace }}"

  source_container_repo_prefix: "{{ c3i_quay_address }}/{{ c3i_quay_namespace }}"

+ semaphore_check: True

@@ -5,3 +5,4 @@ 

  target_tag: stage

  promoting_destination_prefix: "{{ c3i_quay_address }}/{{ c3i_quay_namespace }}"

  source_container_repo_prefix: "{{ c3i_quay_address }}/{{ c3i_quay_namespace }}"

+ semaphore_check: False

Check state of interal semaphore and block deployment to prod.

rebased onto 5df43574b2d72d51eb3b5447a79c969cfa110bca

4 years ago

Build 5df43574b2d72d51eb3b5447a79c969cfa110bca FAILED!
Rebase or make new commits to rebuild.

Build 5df43574b2d72d51eb3b5447a79c969cfa110bca FAILED!
Rebase or make new commits to rebuild.

rebased onto 218e9df15f1da18d5855bd86687fd6e4b61c6b12

4 years ago

Build 218e9df15f1da18d5855bd86687fd6e4b61c6b12 FAILED!
Rebase or make new commits to rebuild.

rebased onto fa9a9ad1609e827cc297af53104e1b608caa56b9

4 years ago

Build fa9a9ad1609e827cc297af53104e1b608caa56b9 FAILED!
Rebase or make new commits to rebuild.

Build fa9a9ad1609e827cc297af53104e1b608caa56b9 FAILED!
Rebase or make new commits to rebuild.

rebased onto b055053fe1dcee29fc5311d9a196048502380a9d

4 years ago

rebased onto 9c03abc45fa8635c4cc19214ce4c59452e6450ac

4 years ago

Build 9c03abc45fa8635c4cc19214ce4c59452e6450ac FAILED!
Rebase or make new commits to rebuild.

Build 9c03abc45fa8635c4cc19214ce4c59452e6450ac FAILED!
Rebase or make new commits to rebuild.

Build 9c03abc45fa8635c4cc19214ce4c59452e6450ac FAILED!
Rebase or make new commits to rebuild.

rebased onto 23e150c

4 years ago

Pull-Request has been merged by mkovarik

4 years ago