-
Notifications
You must be signed in to change notification settings - Fork 17
/
Jenkinsfile_gc
45 lines (45 loc) · 1.82 KB
/
Jenkinsfile_gc
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
pipeline {
agent {
label 'jnlp-linux-arm64'
}
triggers {
cron('@hourly')
}
stages {
stage('Garbage Collection') {
environment {
DRYRUN = "${env.BRANCH_NAME == 'main' ? 'false' : 'true'}"
}
parallel {
stage('GC on Azure') {
environment {
PACKER_AZURE = credentials('packer-azure-serviceprincipal-sponsorship')
}
steps {
sh 'az login --service-principal -u "$PACKER_AZURE_CLIENT_ID" -p "$PACKER_AZURE_CLIENT_SECRET" -t "$PACKER_AZURE_TENANT_ID"'
sh 'az account set -s "$PACKER_AZURE_SUBSCRIPTION_ID"'
sh './cleanup/azure_gallery_images.sh 1 dev'
sh './cleanup/azure_gallery_images.sh 7 staging'
sh './cleanup/azure.sh 1 dev'
sh './cleanup/azure.sh 1 staging'
sh './cleanup/azure.sh 1 prod'
}
}
stage('GC on AWS us-east-2') {
environment {
AWS_ACCESS_KEY_ID = credentials('packer-aws-access-key-id')
AWS_SECRET_ACCESS_KEY = credentials('packer-aws-secret-access-key')
AWS_DEFAULT_REGION = 'us-east-2'
}
steps {
sh 'bash ./cleanup/aws.sh'
sh './cleanup/aws_images.sh 1 dev'
sh './cleanup/aws_images.sh 7 staging'
sh './cleanup/aws_images.sh 60 prod'
sh './cleanup/aws_snapshots.sh'
}
}
}
}
}
}