Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: im-play/dev [2.38] #15511

Merged
merged 3 commits into from
Oct 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions jenkinsfiles/dev
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,59 @@ pipeline {
}
}
}

stage('Update IM Play dev instance') {
environment {
HTTP = "http --check-status"
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_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 {
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')

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.replace(".", "-")}"

dir('scripts/databases') {
env.DATABASE_ID = sh(
returnStdout: true,
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: ${env.DATABASE_ID}"

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}")
}
}
}
}
}
}
}
}

post {
Expand Down
Loading