-
Notifications
You must be signed in to change notification settings - Fork 47
/
Jenkinsfile-image-cleanup
59 lines (53 loc) · 1.86 KB
/
Jenkinsfile-image-cleanup
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
@Library("tada-jenkins-library") _
pipeline {
agent none
options {
disableConcurrentBuilds()
buildDiscarder(logRotator(daysToKeepStr: "30"))
}
triggers {
cron(env.BRANCH_NAME == "main" ? "H H(0-5) * * *" : "")
}
environment {
DEPLOY_IMAGE_REPO_DOMAIN = credentials("reopt-api-image-repo-domain")
APP_IMAGE_REPO_DOMAIN = credentials("reopt-api-app-image-repo-domain")
}
stages {
stage("deploy-agent") {
agent {
docker {
image "${DEPLOY_IMAGE_REPO_DOMAIN}/tada-public/tada-jenkins-kube-deploy:werf-1.2"
args tadaDockerInDockerArgs()
}
}
environment {
TMPDIR = tadaDockerInDockerTmp()
WERF_REPO = "${APP_IMAGE_REPO_DOMAIN}/tada/reopt-api"
WERF_LOG_VERBOSE = "true"
WERF_SYNCHRONIZATION = ":local"
XPRESS_LICENSE_HOST = credentials("reopt-api-xpress-license-host")
NREL_ROOT_CERT_URL_ROOT = credentials("reopt-api-nrel-root-cert-url-root")
}
stages {
stage("cleanup") {
steps {
withDockerRegistry(url: "https://${env.WERF_REPO}", credentialsId: "ecr:us-east-2:aws-nrel-tada-ci") {
withCredentials([aws(credentialsId: "aws-nrel-tada-ci")]) {
tadaRancherAllProjectNamespacesKubeConfig(projects: [[credentialsId: "kubeconfig-nrel-reopt-test", rancherProject: "reopt-api-dev"], [credentialsId: "kubeconfig-nrel-reopt-prod2", rancherProject: "reopt-api-staging"], [credentialsId: "kubeconfig-nrel-reopt-prod2", rancherProject: "reopt-api-production"]]) {
withCredentials([gitUsernamePassword(credentialsId: "github-nrel-gov-admin")]) {
sh "werf cleanup --scan-context-namespace-only"
}
}
}
}
}
}
}
}
}
post {
always {
tadaSendNotifications()
}
}
}