adds cosign to kaniko
This commit is contained in:
parent
16c1a4530a
commit
27cedaa566
@ -19,11 +19,27 @@ spec:
|
|||||||
tty: true
|
tty: true
|
||||||
command:
|
command:
|
||||||
- /busybox/cat
|
- /busybox/cat
|
||||||
|
- name: alpine
|
||||||
|
imagePullPolicy: Always
|
||||||
|
image: ${repository}/library/alpine:latest
|
||||||
|
tty: true
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
""",
|
""",
|
||||||
) {
|
) {
|
||||||
node (label) {
|
node (label) {
|
||||||
def workspace = pwd()
|
def workspace = pwd()
|
||||||
|
|
||||||
|
stage ("Get CoSign") {
|
||||||
|
container ("alpine") {
|
||||||
|
sh """
|
||||||
|
apk add --no-cache curl jq
|
||||||
|
curl --silent --location "\$(curl --silent "https://api.github.com/repos/sigstore/cosign/releases/latest" | jq -r '.assets[0].browser_download_url')" -output "${workspace}/cosign"
|
||||||
|
chmod +x "${workspace}/cosign"
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
stage ("Prepare Kaniko") {
|
stage ("Prepare Kaniko") {
|
||||||
container ("kaniko") {
|
container ("kaniko") {
|
||||||
withCredentials([usernameColonPassword(
|
withCredentials([usernameColonPassword(
|
||||||
@ -62,12 +78,12 @@ spec:
|
|||||||
stage("Build Alpine with CA") {
|
stage("Build Alpine with CA") {
|
||||||
container("kaniko") {
|
container("kaniko") {
|
||||||
def DF = """FROM gcr.io/kaniko-project/executor:debug
|
def DF = """FROM gcr.io/kaniko-project/executor:debug
|
||||||
|
COPY ./cosign /busybox/cosign
|
||||||
COPY kaniko-chain.crt /kaniko/ssl/certs/ca-certificates.crt
|
COPY kaniko-chain.crt /kaniko/ssl/certs/ca-certificates.crt
|
||||||
"""
|
"""
|
||||||
sh "cp /kaniko/ssl/certs/ca-certificates.crt \"${workspace}/kaniko-chain.crt\""
|
sh "cp /kaniko/ssl/certs/ca-certificates.crt \"${workspace}/kaniko-chain.crt\""
|
||||||
writeFile(file: workspace + "/Dockerfile", text: DF)
|
writeFile(file: workspace + "/Dockerfile", text: DF)
|
||||||
sh "/kaniko/executor --cleanup --context \"${workspace}\" -f \"${workspace}/Dockerfile\" --destination \"${repository}/library/kaniko:latest\""
|
sh "/kaniko/executor --cleanup --context \"${workspace}\" -f \"${workspace}/Dockerfile\" --destination \"${repository}/library/kaniko:latest\" --single-snapshot"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user