forked from aquasecurity/linux-bench
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Jenkinsfile
44 lines (42 loc) · 1.9 KB
/
Jenkinsfile
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
pipeline {
agent {
label 'amazon-linux2'
}
stages {
stage('Login to registries') {
steps {
script {
withCredentials([
usernamePassword(credentialsId: 'jenkins-artifactory', usernameVariable: 'ARTIFACTORY_USER', passwordVariable: 'ARTIFACTORY_PASS'),
file(credentialsId: 'google-artifactory-dev-write', variable: 'GAR_WR_SECRET')
]) {
sh '''#!/bin/bash
set -euo pipefail
echo "Logging into Artifactory"
docker login docker.internal.sysdig.com -u="$ARTIFACTORY_USER" -p="$ARTIFACTORY_PASS"
echo "Logging into GAR dev"
cat $GAR_WR_SECRET | docker login --username _json_key --password-stdin us-docker.pkg.dev/sysdig-artifact-registry-dev/gar-docker
'''
}
}
}
}
stage('Build and Push Dependency Image') {
steps {
checkout([$class: 'GitSCM',
branches: [[name: "${params.TAG}"]],
doGenerateSubmoduleConfigurations: false,
extensions: [],
submoduleCfg: [],
userRemoteConfigs: [[credentialsId: 'github-jenkins-user-token', url: 'https://github.com/draios/linux-bench.git']]
])
script {
docker.withRegistry("https://docker.internal.sysdig.com", 'jenkins-artifactory') {
sh "IMAGE_TAG=${params.TAG} PUSH=yes make -f makefile-sysdig build-dependency-image"
sh "IMAGE_TAG=${params.TAG} PUSH=yes make -f makefile-sysdig build-dependency-image-gar"
}
}
}
}
}
}