Skip to content

Commit

Permalink
ci: im-play/dev [2.40] (#15502)
Browse files Browse the repository at this point in the history
* im-play/dev (#15481)

* chore: deploy all supported dev branches [skip ci]

* chore: use database slug rather than retrieving id [skip ci]

* chore: clean up [skip ci]

* chore: fix indent [skip ci]

* chore: set image tag based on the branch [skip ci]

* chore: test with 2.40

* chore: dns_rfc1035 can't start with numeric char

* chore: misc. clean up

(cherry picked from commit 90f5d0f)
Signed-off-by: TonsV2 <[email protected]>

* ci: strip dash if master (#15498)

Signed-off-by: TonsV2 <[email protected]>
(cherry picked from commit 3a36b68)
  • Loading branch information
tonsV2 authored Oct 26, 2023
1 parent e16535d commit d1d5f82
Showing 1 changed file with 26 additions and 20 deletions.
46 changes: 26 additions & 20 deletions jenkinsfiles/dev
Original file line number Diff line number Diff line change
Expand Up @@ -191,42 +191,48 @@ pipeline {
stage('Update IM Play dev instance') {
environment {
HTTP = "http --check-status"
IM_HOST = "https://api.im.prod.test.c.dhis2.org"
INSTANCE_URL = "https://play.im.prod.test.c.dhis2.org/dev"
IM_REPO_URL = "https://github.com/dhis2-sre/im-manager"
IM_HOST = "https://api.im.dhis2.org"
INSTANCE_URL = "https://play.im.dhis2.org/dev"
IMAGE_REPOSITORY = "core-dev"
IMAGE_TAG = "latest"
IMAGE_PULL_POLICY = "Always"
FLYWAY_MIGRATE_OUT_OF_ORDER = "true"
FLYWAY_REPAIR_BEFORE_MIGRATION = "true"
INSTANCE_TTL = "315360000"
STARTUP_PROBE_FAILURE_THRESHOLD = "50"
LIVENESS_PROBE_TIMEOUT_SECONDS = "3"
READINESS_PROBE_TIMEOUT_SECONDS = "3"
}
steps {
script {
if (env.GIT_BRANCH == 'master') {
withCredentials([usernamePassword(credentialsId: 'dhis2-im-bot', passwordVariable: 'PASSWORD', usernameVariable: 'USER_EMAIL')]) {
dir('im-db-manager') {
gitHelper.sparseCheckout('https://github.com/dhis2-sre/im-database-manager', 'master', '/scripts')
withCredentials([usernamePassword(credentialsId: 'dhis2-im-bot', passwordVariable: 'PASSWORD', usernameVariable: 'USER_EMAIL')]) {
dir('im-manager') {
gitHelper.sparseCheckout(IM_REPO_URL, "${gitHelper.getLatestTag(IM_REPO_URL)}", '/scripts')

dir('scripts') {
echo 'Creating DHIS2 instance on IM...'
def branch = ""
if (env.GIT_BRANCH == 'master') {
env.IMAGE_TAG = "latest"
env.DATABASE_ID = "test-dbs-sierra-leone-dev-sql-gz"
} else {
env.IMAGE_TAG = env.GIT_BRANCH
branch = "-${env.GIT_BRANCH.replaceAll(".", "-")}"

dir('scripts/databases') {
env.DATABASE_ID = sh(
returnStdout: true,
script: "./list.sh | jq -r '.[] | select(.Name == \"whoami\") | .Databases[] | select(.Name == \"Sierra Leone - dev.sql.gz\") | .ID'"
script: "./list.sh | jq -r '.[] | select(.name == \"test-dbs\") | .databases[] | select(.name == \"sierra-leone/${env.GIT_BRANCH}.sql.gz\") | .slug'"
).trim()

sh '[ -n "$DATABASE_ID" ]'
echo "DATABASE_ID is ${env.DATABASE_ID}"
}
}

dir('im-manager') {
gitHelper.sparseCheckout('https://github.com/dhis2-sre/im-manager', 'master', '/scripts')
sh '[ -n "$DATABASE_ID" ]'
echo "Database: ${env.DATABASE_ID}"

dir('scripts') {
echo 'Creating DHIS2 instance on IM...'
sh "(./findByName.sh play dev && ./restart.sh play dev) || ./deploy-dhis2.sh play dev"
timeout(5) {
waitFor.statusOk("${env.INSTANCE_URL}")
}
dir('scripts/instances') {
sh "(./findByName.sh play dev${branch} && ./restart.sh play dev${branch}) || ./deploy-dhis2.sh play dev${branch}"
timeout(5) {
waitFor.statusOk("${env.INSTANCE_URL}")
}
}
}
Expand Down

0 comments on commit d1d5f82

Please sign in to comment.