Hi,
I have 2 jenkins pipeline’s:
1.) deploy-release: This will deploy single component based on release version
2.) deploy-all-components-release: This will deploy all the component’s based on release version
This is my use-case:
When I run the 1st pipeline I am running the testing framework for that single component and for this I have a stage which will execute in the end after deployment.And when I run the 2nd pipeline so this pipeline itself executes the same deploy-release pipeline to deploy it but it runs for all one after the another.Now in the 2nd pipeline also I am executing the testing framework for all component’s deployed.
So how can I add the handling that if there is execution going on for 2 pipeline,dont execute the testing framework in the 1st pipeline.I got one env var called JOB_NAME from context.json which I can use but don’t know where and how to add this logic.
The pipeline is written in yaml format and the stages are calling groovy handlers.
1st Pipeline
deploy-release:
stages:
- <<: *docker_pull
name: nexus_pull_awx
servers: []
environments: []
handlers:
- name: 'Docker pull image'
handler: Docker.pull
parameters:
<<: *docker_pull_parameters
pull_name: '${context.awx_name.replaceAll(/^[^a-zA-Z0-9_\.$]+/, "").replaceAll(/[^a-zA-Z0-9_\.]+/, "_").toLowerCase()}'
image_name: '${context.env.DOCKER_3ED_NEXUS_URL}/${context.awx_name}'
image_tag: '${context.awx_version}'
testing_kit_component_list: &testing_kit_component_list
<<: *testing_kit
handlers:
- <<: *testing_kit_dependency
- <<: *testing_kit_handler
env: &testing_kit_component_list_env
<<: *testing_kit_env
TESTING_KIT_TEST_PATH: '${context.containsKey("component_tests") ? context.component_tests.join(",") : "all/monitoring/components_testing/" + context.component_name}'
parameters: &testing_kit_component_list_parameters
<<: *testing_kit_parameters
2nd pipeline
deploy-all-components-release:
timeout: 4
stages:
- <<: *deployment_operator_refresh
servers:
- sub_user
environments: []
- <<: *build_deploy_component
name: ansible
handlers:
- <<: *deploy_component_handler
parameters:
<<: *deploy_component_parameters
job_name: 'monitoring/ansible/bp/deploy-release'
- <<: *testing_kit
name: Execute Testing for All Components
servers:
- sub_user
environments: []
Thanks in Advance