Skip to content

Commit 18fbc56

Browse files
authored
Merge pull request #1755 from cmu-delphi/1747-add-newmodify-build-+-package-+-deploy-stage-to-accommodate-the-new-indicator-versioning-actions-workflow
Modify (build + package) + deploy to go with new indicator versioning Actions workflow
2 parents 3d2581f + 66fb6ea commit 18fbc56

File tree

5 files changed

+27
-9
lines changed

5 files changed

+27
-9
lines changed

Jenkinsfile

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,41 @@
1010
- TODO: #527 Get this list automatically from python-ci.yml at runtime.
1111
*/
1212
def indicator_list = ["backfill_corrections", "changehc", "claims_hosp", "google_symptoms", "hhs_hosp", "jhu", "nchs_mortality", "quidel", "quidel_covidtest", "safegraph_patterns", "sir_complainsalot", "usafacts", "dsew_community_profile", "doctor_visits"]
13-
def build_package = [:]
13+
def build_package_main = [:]
14+
def build_package_prod = [:]
1415
def deploy_staging = [:]
1516
def deploy_production = [:]
1617

1718
pipeline {
1819
agent any
1920
stages {
20-
stage('Build and Package') {
21+
stage('Build and Package main') {
2122
when {
2223
branch "main";
2324
}
2425
steps {
2526
script {
2627
indicator_list.each { indicator ->
27-
build_package[indicator] = {
28-
sh "jenkins/build-and-package.sh ${indicator}"
28+
build_package_main[indicator] = {
29+
sh "jenkins/build-and-package.sh ${indicator} main"
2930
}
3031
}
31-
parallel build_package
32+
parallel build_package_main
33+
}
34+
}
35+
}
36+
stage('Build and Package prod') {
37+
when {
38+
branch "prod";
39+
}
40+
steps {
41+
script {
42+
indicator_list.each { indicator ->
43+
build_package_prod[indicator] = {
44+
sh "jenkins/build-and-package.sh ${indicator} prod"
45+
}
46+
}
47+
parallel build_package_prod
3248
}
3349
}
3450
}

ansible/ansible-deploy-staging.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
tasks:
77
- name: Copy and unarchive the package into the indicators runtime host directory.
88
unarchive:
9-
src: "{{ jenkins_artifact_dir }}/{{ package }}"
9+
src: "{{ jenkins_artifact_dir }}/{{ package_staging }}"
1010
dest: "{{ indicators_runtime_dir }}"
1111
owner: "{{ runtime_user }}"
1212
group: "{{ runtime_user }}"

ansible/ansible-deploy.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
tasks:
77
- name: Copy and unarchive the package into the indicators runtime host directory.
88
unarchive:
9-
src: "{{ jenkins_artifact_dir }}/{{ package }}"
9+
src: "{{ jenkins_artifact_dir }}/{{ package_production }}"
1010
dest: "{{ indicators_runtime_dir }}"
1111
owner: "{{ runtime_user }}"
1212
group: "{{ runtime_user }}"

ansible/vars.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ runtime_user: "indicators"
66
jenkins_user: "jenkins"
77
jenkins_artifact_dir: "/var/lib/jenkins/artifacts"
88
indicators_runtime_dir: "/home/{{ runtime_user }}/runtime"
9-
package: "{{ indicator }}.tar.gz" # {{ indicator }} is passed in from the Jenkins shell script wrapper.
9+
package_staging: "main_{{ indicator }}.tar.gz" # {{ indicator }} is passed in from the Jenkins shell script wrapper.
10+
package_production: "prod_{{ indicator }}.tar.gz" # {{ indicator }} is passed in from the Jenkins shell script wrapper.
1011
python_version: "3.8.2"
1112
pyenv_python_path: "/home/{{ runtime_user }}/.pyenv/versions/{{ python_version }}/bin/python"
1213

jenkins/build-and-package.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ source ~/.bash_profile
88

99
# Vars
1010
local_indicator=$1
11+
branch=$2
1112

1213
#
1314
# Build
@@ -30,4 +31,4 @@ pip install ../_delphi_utils_python/. --retries 10 --timeout 20
3031
cd "${WORKSPACE}" || exit
3132

3233
# Create .tar.gz for deployment
33-
tar -czvf "${JENKINS_HOME}/artifacts/${local_indicator}.tar.gz" "${local_indicator}"
34+
tar -czvf "${JENKINS_HOME}/artifacts/${branch}_${local_indicator}.tar.gz" "${local_indicator}"

0 commit comments

Comments
 (0)