Switch to using BuiltKit instead of Kaniko to build docker images.
This commit is contained in:
parent
e6b4bc3d94
commit
d80b473fae
@ -69,42 +69,72 @@ spec:
|
|||||||
value: $(params.PULL_BASE_SHA)
|
value: $(params.PULL_BASE_SHA)
|
||||||
- name: deleteExisting
|
- name: deleteExisting
|
||||||
value: "true"
|
value: "true"
|
||||||
|
- name: get-git-commit-time
|
||||||
|
taskSpec:
|
||||||
|
metadata: {}
|
||||||
|
stepTemplate:
|
||||||
|
image: alpine:3.20
|
||||||
|
computeResources:
|
||||||
|
requests:
|
||||||
|
cpu: 10m
|
||||||
|
memory: 600Mi
|
||||||
|
workingDir: "$(workspaces.repo.path)"
|
||||||
|
results:
|
||||||
|
- name: unix-time
|
||||||
|
description: The time of the git commit in unix timestamp format.
|
||||||
|
steps:
|
||||||
|
- image: alpine/git:v2.34.2
|
||||||
|
name: detect-tag-step
|
||||||
|
script: |
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
set -euo pipefail
|
||||||
|
echo -n "$(git log -1 --pretty=%ct)" | tee $(results.unix-time.path)
|
||||||
|
workspaces:
|
||||||
|
- name: repo
|
||||||
|
workspace: git-source
|
||||||
|
runAfter:
|
||||||
|
- fetch-repository
|
||||||
- name: build-image
|
- name: build-image
|
||||||
taskRef:
|
taskRef:
|
||||||
resolver: git
|
resolver: git
|
||||||
params:
|
params:
|
||||||
- name: url
|
- name: url
|
||||||
value: https://code.fizz.buzz/mirror/catalog.git # mirror of https://github.com/tektoncd/catalog.git
|
value: https://code.fizz.buzz/talexander/personal_tekton_catalog.git
|
||||||
- name: revision
|
- name: revision
|
||||||
value: df36b3853a5657fd883015cdbf07ad6466918acf
|
value: 7ee31a185243ee6da13dcd26a592c585b64c80e5
|
||||||
- name: pathInRepo
|
- name: pathInRepo
|
||||||
value: task/kaniko/0.6/kaniko.yaml
|
value: task/buildkit-rootless-daemonless/0.1/buildkit-rootless-daemonless.yaml
|
||||||
params:
|
params:
|
||||||
- name: IMAGE
|
- name: OUTPUT
|
||||||
value: "$(params.image-name):$(tasks.fetch-repository.results.commit)"
|
value: >-
|
||||||
|
type=image,"name=$(params.image-name):latest,$(params.image-name):$(tasks.fetch-repository.results.commit)",push=true,compression=zstd,compression-level=22,oci-mediatypes=true
|
||||||
- name: CONTEXT
|
- name: CONTEXT
|
||||||
value: $(params.path-to-image-context)
|
value: $(params.path-to-image-context)
|
||||||
- name: DOCKERFILE
|
- name: DOCKERFILE
|
||||||
value: $(params.path-to-dockerfile)
|
value: $(params.path-to-dockerfile)
|
||||||
- name: BUILDER_IMAGE
|
|
||||||
value: "gcr.io/kaniko-project/executor:v1.12.1"
|
|
||||||
- name: EXTRA_ARGS
|
- name: EXTRA_ARGS
|
||||||
value:
|
value:
|
||||||
- "--destination=$(params.image-name)" # Also write the :latest image
|
- --import-cache
|
||||||
- "--target=$(params.target-name)"
|
- "type=registry,ref=$(params.image-name):buildcache"
|
||||||
- --cache=true
|
- --export-cache
|
||||||
- --cache-copy-layers
|
- "type=registry,ref=$(params.image-name):buildcache,mode=max,compression=zstd,compression-level=22,rewrite-timestamp=true,image-manifest=true,oci-mediatypes=true"
|
||||||
- --cache-repo=harbor.fizz.buzz/kanikocache/cache
|
- --opt
|
||||||
- --use-new-run # Should result in a speed-up
|
- build-arg:SOURCE_DATE_EPOCH=$(tasks.get-git-commit-time.results.unix-time)
|
||||||
- --reproducible # To remove timestamps so layer caching works.
|
- name: BUILDKITD_TOML
|
||||||
- --snapshot-mode=redo
|
value: |
|
||||||
- --skip-unused-stages=true
|
debug = true
|
||||||
- --registry-mirror=dockerhub.dockerhub.svc.cluster.local
|
[registry."docker.io"]
|
||||||
|
mirrors = ["dockerhub.dockerhub.svc.cluster.local"]
|
||||||
|
[registry."dockerhub.dockerhub.svc.cluster.local"]
|
||||||
|
http = true
|
||||||
|
insecure = true
|
||||||
workspaces:
|
workspaces:
|
||||||
- name: source
|
- name: source
|
||||||
workspace: git-source
|
workspace: git-source
|
||||||
- name: dockerconfig
|
- name: dockerconfig
|
||||||
workspace: docker-credentials
|
workspace: docker-credentials
|
||||||
|
runAfter:
|
||||||
|
- fetch-repository
|
||||||
#############
|
#############
|
||||||
- name: run-image-none
|
- name: run-image-none
|
||||||
taskSpec:
|
taskSpec:
|
||||||
@ -147,7 +177,7 @@ spec:
|
|||||||
- build-image
|
- build-image
|
||||||
params:
|
params:
|
||||||
- name: docker-image
|
- name: docker-image
|
||||||
value: "$(params.image-name):$(tasks.fetch-repository.results.commit)"
|
value: "$(tasks.build-image.results.IMAGE_URL[1])"
|
||||||
#############
|
#############
|
||||||
- name: run-image-tracing
|
- name: run-image-tracing
|
||||||
taskSpec:
|
taskSpec:
|
||||||
@ -190,7 +220,7 @@ spec:
|
|||||||
- run-image-none
|
- run-image-none
|
||||||
params:
|
params:
|
||||||
- name: docker-image
|
- name: docker-image
|
||||||
value: "$(params.image-name):$(tasks.fetch-repository.results.commit)"
|
value: "$(tasks.build-image.results.IMAGE_URL[1])"
|
||||||
#############
|
#############
|
||||||
- name: run-image-compare
|
- name: run-image-compare
|
||||||
taskSpec:
|
taskSpec:
|
||||||
@ -233,7 +263,7 @@ spec:
|
|||||||
- run-image-tracing
|
- run-image-tracing
|
||||||
params:
|
params:
|
||||||
- name: docker-image
|
- name: docker-image
|
||||||
value: "$(params.image-name):$(tasks.fetch-repository.results.commit)"
|
value: "$(tasks.build-image.results.IMAGE_URL[1])"
|
||||||
#############
|
#############
|
||||||
- name: run-image-default
|
- name: run-image-default
|
||||||
taskSpec:
|
taskSpec:
|
||||||
@ -276,7 +306,7 @@ spec:
|
|||||||
- run-image-compare
|
- run-image-compare
|
||||||
params:
|
params:
|
||||||
- name: docker-image
|
- name: docker-image
|
||||||
value: "$(params.image-name):$(tasks.fetch-repository.results.commit)"
|
value: "$(tasks.build-image.results.IMAGE_URL[1])"
|
||||||
#############
|
#############
|
||||||
- name: run-image-tracing-compare
|
- name: run-image-tracing-compare
|
||||||
taskSpec:
|
taskSpec:
|
||||||
@ -319,7 +349,7 @@ spec:
|
|||||||
- run-image-default
|
- run-image-default
|
||||||
params:
|
params:
|
||||||
- name: docker-image
|
- name: docker-image
|
||||||
value: "$(params.image-name):$(tasks.fetch-repository.results.commit)"
|
value: "$(tasks.build-image.results.IMAGE_URL[1])"
|
||||||
#############
|
#############
|
||||||
- name: run-image-compare-foreign
|
- name: run-image-compare-foreign
|
||||||
taskSpec:
|
taskSpec:
|
||||||
@ -367,7 +397,7 @@ spec:
|
|||||||
- run-image-tracing-compare
|
- run-image-tracing-compare
|
||||||
params:
|
params:
|
||||||
- name: docker-image
|
- name: docker-image
|
||||||
value: "$(params.image-name):$(tasks.fetch-repository.results.commit)"
|
value: "$(tasks.build-image.results.IMAGE_URL[1])"
|
||||||
#############
|
#############
|
||||||
- name: run-image-all
|
- name: run-image-all
|
||||||
taskSpec:
|
taskSpec:
|
||||||
@ -415,7 +445,7 @@ spec:
|
|||||||
- run-image-compare-foreign
|
- run-image-compare-foreign
|
||||||
params:
|
params:
|
||||||
- name: docker-image
|
- name: docker-image
|
||||||
value: "$(params.image-name):$(tasks.fetch-repository.results.commit)"
|
value: "$(tasks.build-image.results.IMAGE_URL[1])"
|
||||||
#############
|
#############
|
||||||
- name: run-image-wasm
|
- name: run-image-wasm
|
||||||
taskSpec:
|
taskSpec:
|
||||||
@ -469,7 +499,7 @@ spec:
|
|||||||
- run-image-all
|
- run-image-all
|
||||||
params:
|
params:
|
||||||
- name: docker-image
|
- name: docker-image
|
||||||
value: "$(params.image-name):$(tasks.fetch-repository.results.commit)"
|
value: "$(tasks.build-image.results.IMAGE_URL[1])"
|
||||||
#############
|
#############
|
||||||
- name: run-image-wasm-test
|
- name: run-image-wasm-test
|
||||||
taskSpec:
|
taskSpec:
|
||||||
@ -519,7 +549,7 @@ spec:
|
|||||||
- run-image-wasm
|
- run-image-wasm
|
||||||
params:
|
params:
|
||||||
- name: docker-image
|
- name: docker-image
|
||||||
value: "$(params.image-name):$(tasks.fetch-repository.results.commit)"
|
value: "$(tasks.build-image.results.IMAGE_URL[1])"
|
||||||
#############
|
#############
|
||||||
finally:
|
finally:
|
||||||
- name: report-success
|
- name: report-success
|
||||||
@ -621,7 +651,7 @@ spec:
|
|||||||
subPath: $(params.cache-subdir)
|
subPath: $(params.cache-subdir)
|
||||||
params:
|
params:
|
||||||
- name: docker-image
|
- name: docker-image
|
||||||
value: "$(params.image-name):$(tasks.fetch-repository.results.commit)"
|
value: "$(tasks.build-image.results.IMAGE_URL[1])"
|
||||||
- name: cache-subdir
|
- name: cache-subdir
|
||||||
value: none
|
value: none
|
||||||
# matrix:
|
# matrix:
|
||||||
@ -666,4 +696,4 @@ spec:
|
|||||||
- name: path-to-image-context
|
- name: path-to-image-context
|
||||||
value: .
|
value: .
|
||||||
- name: path-to-dockerfile
|
- name: path-to-dockerfile
|
||||||
value: docker/organic_development/Dockerfile
|
value: docker/organic_development/
|
||||||
|
@ -69,41 +69,72 @@ spec:
|
|||||||
value: $(params.PULL_BASE_SHA)
|
value: $(params.PULL_BASE_SHA)
|
||||||
- name: deleteExisting
|
- name: deleteExisting
|
||||||
value: "true"
|
value: "true"
|
||||||
|
- name: get-git-commit-time
|
||||||
|
taskSpec:
|
||||||
|
metadata: {}
|
||||||
|
stepTemplate:
|
||||||
|
image: alpine:3.20
|
||||||
|
computeResources:
|
||||||
|
requests:
|
||||||
|
cpu: 10m
|
||||||
|
memory: 600Mi
|
||||||
|
workingDir: "$(workspaces.repo.path)"
|
||||||
|
results:
|
||||||
|
- name: unix-time
|
||||||
|
description: The time of the git commit in unix timestamp format.
|
||||||
|
steps:
|
||||||
|
- image: alpine/git:v2.34.2
|
||||||
|
name: detect-tag-step
|
||||||
|
script: |
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
set -euo pipefail
|
||||||
|
echo -n "$(git log -1 --pretty=%ct)" | tee $(results.unix-time.path)
|
||||||
|
workspaces:
|
||||||
|
- name: repo
|
||||||
|
workspace: git-source
|
||||||
|
runAfter:
|
||||||
|
- fetch-repository
|
||||||
- name: build-image
|
- name: build-image
|
||||||
taskRef:
|
taskRef:
|
||||||
resolver: git
|
resolver: git
|
||||||
params:
|
params:
|
||||||
- name: url
|
- name: url
|
||||||
value: https://code.fizz.buzz/mirror/catalog.git # mirror of https://github.com/tektoncd/catalog.git
|
value: https://code.fizz.buzz/talexander/personal_tekton_catalog.git
|
||||||
- name: revision
|
- name: revision
|
||||||
value: df36b3853a5657fd883015cdbf07ad6466918acf
|
value: 7ee31a185243ee6da13dcd26a592c585b64c80e5
|
||||||
- name: pathInRepo
|
- name: pathInRepo
|
||||||
value: task/kaniko/0.6/kaniko.yaml
|
value: task/buildkit-rootless-daemonless/0.1/buildkit-rootless-daemonless.yaml
|
||||||
params:
|
params:
|
||||||
- name: IMAGE
|
- name: OUTPUT
|
||||||
value: "$(params.image-name):$(tasks.fetch-repository.results.commit)"
|
value: >-
|
||||||
|
type=image,"name=$(params.image-name):latest,$(params.image-name):$(tasks.fetch-repository.results.commit)",push=true,compression=zstd,compression-level=22,oci-mediatypes=true
|
||||||
- name: CONTEXT
|
- name: CONTEXT
|
||||||
value: $(params.path-to-image-context)
|
value: $(params.path-to-image-context)
|
||||||
- name: DOCKERFILE
|
- name: DOCKERFILE
|
||||||
value: $(params.path-to-dockerfile)
|
value: $(params.path-to-dockerfile)
|
||||||
- name: BUILDER_IMAGE
|
|
||||||
value: "gcr.io/kaniko-project/executor:v1.12.1"
|
|
||||||
- name: EXTRA_ARGS
|
- name: EXTRA_ARGS
|
||||||
value:
|
value:
|
||||||
- "--target=$(params.target-name)"
|
- --import-cache
|
||||||
- --cache=true
|
- "type=registry,ref=$(params.image-name):buildcache"
|
||||||
- --cache-copy-layers
|
- --export-cache
|
||||||
- --cache-repo=harbor.fizz.buzz/kanikocache/cache
|
- "type=registry,ref=$(params.image-name):buildcache,mode=max,compression=zstd,compression-level=22,rewrite-timestamp=true,image-manifest=true,oci-mediatypes=true"
|
||||||
- --use-new-run # Should result in a speed-up
|
- --opt
|
||||||
- --reproducible # To remove timestamps so layer caching works.
|
- build-arg:SOURCE_DATE_EPOCH=$(tasks.get-git-commit-time.results.unix-time)
|
||||||
- --snapshot-mode=redo
|
- name: BUILDKITD_TOML
|
||||||
- --skip-unused-stages=true
|
value: |
|
||||||
- --registry-mirror=dockerhub.dockerhub.svc.cluster.local
|
debug = true
|
||||||
|
[registry."docker.io"]
|
||||||
|
mirrors = ["dockerhub.dockerhub.svc.cluster.local"]
|
||||||
|
[registry."dockerhub.dockerhub.svc.cluster.local"]
|
||||||
|
http = true
|
||||||
|
insecure = true
|
||||||
workspaces:
|
workspaces:
|
||||||
- name: source
|
- name: source
|
||||||
workspace: git-source
|
workspace: git-source
|
||||||
- name: dockerconfig
|
- name: dockerconfig
|
||||||
workspace: docker-credentials
|
workspace: docker-credentials
|
||||||
|
runAfter:
|
||||||
|
- fetch-repository
|
||||||
- name: run-test
|
- name: run-test
|
||||||
taskSpec:
|
taskSpec:
|
||||||
metadata: {}
|
metadata: {}
|
||||||
@ -141,7 +172,7 @@ spec:
|
|||||||
- build-image
|
- build-image
|
||||||
params:
|
params:
|
||||||
- name: docker-image
|
- name: docker-image
|
||||||
value: "$(params.image-name):$(tasks.fetch-repository.results.commit)"
|
value: "$(tasks.build-image.results.IMAGE_URL[1])"
|
||||||
finally:
|
finally:
|
||||||
- name: report-success
|
- name: report-success
|
||||||
when:
|
when:
|
||||||
@ -235,7 +266,7 @@ spec:
|
|||||||
workspace: cargo-cache
|
workspace: cargo-cache
|
||||||
params:
|
params:
|
||||||
- name: docker-image
|
- name: docker-image
|
||||||
value: "$(params.image-name):$(tasks.fetch-repository.results.commit)"
|
value: "$(tasks.build-image.results.IMAGE_URL[1])"
|
||||||
workspaces:
|
workspaces:
|
||||||
- name: git-source
|
- name: git-source
|
||||||
- name: docker-credentials
|
- name: docker-credentials
|
||||||
@ -265,4 +296,4 @@ spec:
|
|||||||
- name: path-to-image-context
|
- name: path-to-image-context
|
||||||
value: docker/organic_test/
|
value: docker/organic_test/
|
||||||
- name: path-to-dockerfile
|
- name: path-to-dockerfile
|
||||||
value: docker/organic_test/Dockerfile
|
value: docker/organic_test/
|
||||||
|
@ -69,41 +69,72 @@ spec:
|
|||||||
value: $(params.PULL_BASE_SHA)
|
value: $(params.PULL_BASE_SHA)
|
||||||
- name: deleteExisting
|
- name: deleteExisting
|
||||||
value: "true"
|
value: "true"
|
||||||
|
- name: get-git-commit-time
|
||||||
|
taskSpec:
|
||||||
|
metadata: {}
|
||||||
|
stepTemplate:
|
||||||
|
image: alpine:3.20
|
||||||
|
computeResources:
|
||||||
|
requests:
|
||||||
|
cpu: 10m
|
||||||
|
memory: 600Mi
|
||||||
|
workingDir: "$(workspaces.repo.path)"
|
||||||
|
results:
|
||||||
|
- name: unix-time
|
||||||
|
description: The time of the git commit in unix timestamp format.
|
||||||
|
steps:
|
||||||
|
- image: alpine/git:v2.34.2
|
||||||
|
name: detect-tag-step
|
||||||
|
script: |
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
set -euo pipefail
|
||||||
|
echo -n "$(git log -1 --pretty=%ct)" | tee $(results.unix-time.path)
|
||||||
|
workspaces:
|
||||||
|
- name: repo
|
||||||
|
workspace: git-source
|
||||||
|
runAfter:
|
||||||
|
- fetch-repository
|
||||||
- name: build-image
|
- name: build-image
|
||||||
taskRef:
|
taskRef:
|
||||||
resolver: git
|
resolver: git
|
||||||
params:
|
params:
|
||||||
- name: url
|
- name: url
|
||||||
value: https://code.fizz.buzz/mirror/catalog.git # mirror of https://github.com/tektoncd/catalog.git
|
value: https://code.fizz.buzz/talexander/personal_tekton_catalog.git
|
||||||
- name: revision
|
- name: revision
|
||||||
value: df36b3853a5657fd883015cdbf07ad6466918acf
|
value: 7ee31a185243ee6da13dcd26a592c585b64c80e5
|
||||||
- name: pathInRepo
|
- name: pathInRepo
|
||||||
value: task/kaniko/0.6/kaniko.yaml
|
value: task/buildkit-rootless-daemonless/0.1/buildkit-rootless-daemonless.yaml
|
||||||
params:
|
params:
|
||||||
- name: IMAGE
|
- name: OUTPUT
|
||||||
value: "$(params.image-name):$(tasks.fetch-repository.results.commit)"
|
value: >-
|
||||||
|
type=image,"name=$(params.image-name):latest,$(params.image-name):$(tasks.fetch-repository.results.commit)",push=true,compression=zstd,compression-level=22,oci-mediatypes=true
|
||||||
- name: CONTEXT
|
- name: CONTEXT
|
||||||
value: $(params.path-to-image-context)
|
value: $(params.path-to-image-context)
|
||||||
- name: DOCKERFILE
|
- name: DOCKERFILE
|
||||||
value: $(params.path-to-dockerfile)
|
value: $(params.path-to-dockerfile)
|
||||||
- name: BUILDER_IMAGE
|
|
||||||
value: "gcr.io/kaniko-project/executor:v1.12.1"
|
|
||||||
- name: EXTRA_ARGS
|
- name: EXTRA_ARGS
|
||||||
value:
|
value:
|
||||||
- "--target=$(params.target-name)"
|
- --import-cache
|
||||||
- --cache=true
|
- "type=registry,ref=$(params.image-name):buildcache"
|
||||||
- --cache-copy-layers
|
- --export-cache
|
||||||
- --cache-repo=harbor.fizz.buzz/kanikocache/cache
|
- "type=registry,ref=$(params.image-name):buildcache,mode=max,compression=zstd,compression-level=22,rewrite-timestamp=true,image-manifest=true,oci-mediatypes=true"
|
||||||
- --use-new-run # Should result in a speed-up
|
- --opt
|
||||||
- --reproducible # To remove timestamps so layer caching works.
|
- build-arg:SOURCE_DATE_EPOCH=$(tasks.get-git-commit-time.results.unix-time)
|
||||||
- --snapshot-mode=redo
|
- name: BUILDKITD_TOML
|
||||||
- --skip-unused-stages=true
|
value: |
|
||||||
- --registry-mirror=dockerhub.dockerhub.svc.cluster.local
|
debug = true
|
||||||
|
[registry."docker.io"]
|
||||||
|
mirrors = ["dockerhub.dockerhub.svc.cluster.local"]
|
||||||
|
[registry."dockerhub.dockerhub.svc.cluster.local"]
|
||||||
|
http = true
|
||||||
|
insecure = true
|
||||||
workspaces:
|
workspaces:
|
||||||
- name: source
|
- name: source
|
||||||
workspace: git-source
|
workspace: git-source
|
||||||
- name: dockerconfig
|
- name: dockerconfig
|
||||||
workspace: docker-credentials
|
workspace: docker-credentials
|
||||||
|
runAfter:
|
||||||
|
- fetch-repository
|
||||||
- name: run-cargo-fmt
|
- name: run-cargo-fmt
|
||||||
taskSpec:
|
taskSpec:
|
||||||
metadata: {}
|
metadata: {}
|
||||||
@ -143,7 +174,7 @@ spec:
|
|||||||
- build-image
|
- build-image
|
||||||
params:
|
params:
|
||||||
- name: docker-image
|
- name: docker-image
|
||||||
value: "$(params.image-name):$(tasks.fetch-repository.results.commit)"
|
value: "$(tasks.build-image.results.IMAGE_URL[1])"
|
||||||
- name: commit-changes
|
- name: commit-changes
|
||||||
taskRef:
|
taskRef:
|
||||||
resolver: git
|
resolver: git
|
||||||
@ -268,7 +299,7 @@ spec:
|
|||||||
workspace: cargo-cache
|
workspace: cargo-cache
|
||||||
params:
|
params:
|
||||||
- name: docker-image
|
- name: docker-image
|
||||||
value: "$(params.image-name):$(tasks.fetch-repository.results.commit)"
|
value: "$(tasks.build-image.results.IMAGE_URL[1])"
|
||||||
workspaces:
|
workspaces:
|
||||||
- name: git-source
|
- name: git-source
|
||||||
- name: docker-credentials
|
- name: docker-credentials
|
||||||
@ -298,4 +329,4 @@ spec:
|
|||||||
- name: path-to-image-context
|
- name: path-to-image-context
|
||||||
value: docker/organic_development/
|
value: docker/organic_development/
|
||||||
- name: path-to-dockerfile
|
- name: path-to-dockerfile
|
||||||
value: docker/organic_development/Dockerfile
|
value: docker/organic_development/
|
||||||
|
@ -69,41 +69,72 @@ spec:
|
|||||||
value: $(params.PULL_BASE_SHA)
|
value: $(params.PULL_BASE_SHA)
|
||||||
- name: deleteExisting
|
- name: deleteExisting
|
||||||
value: "true"
|
value: "true"
|
||||||
|
- name: get-git-commit-time
|
||||||
|
taskSpec:
|
||||||
|
metadata: {}
|
||||||
|
stepTemplate:
|
||||||
|
image: alpine:3.20
|
||||||
|
computeResources:
|
||||||
|
requests:
|
||||||
|
cpu: 10m
|
||||||
|
memory: 600Mi
|
||||||
|
workingDir: "$(workspaces.repo.path)"
|
||||||
|
results:
|
||||||
|
- name: unix-time
|
||||||
|
description: The time of the git commit in unix timestamp format.
|
||||||
|
steps:
|
||||||
|
- image: alpine/git:v2.34.2
|
||||||
|
name: detect-tag-step
|
||||||
|
script: |
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
set -euo pipefail
|
||||||
|
echo -n "$(git log -1 --pretty=%ct)" | tee $(results.unix-time.path)
|
||||||
|
workspaces:
|
||||||
|
- name: repo
|
||||||
|
workspace: git-source
|
||||||
|
runAfter:
|
||||||
|
- fetch-repository
|
||||||
- name: build-image
|
- name: build-image
|
||||||
taskRef:
|
taskRef:
|
||||||
resolver: git
|
resolver: git
|
||||||
params:
|
params:
|
||||||
- name: url
|
- name: url
|
||||||
value: https://code.fizz.buzz/mirror/catalog.git # mirror of https://github.com/tektoncd/catalog.git
|
value: https://code.fizz.buzz/talexander/personal_tekton_catalog.git
|
||||||
- name: revision
|
- name: revision
|
||||||
value: df36b3853a5657fd883015cdbf07ad6466918acf
|
value: 7ee31a185243ee6da13dcd26a592c585b64c80e5
|
||||||
- name: pathInRepo
|
- name: pathInRepo
|
||||||
value: task/kaniko/0.6/kaniko.yaml
|
value: task/buildkit-rootless-daemonless/0.1/buildkit-rootless-daemonless.yaml
|
||||||
params:
|
params:
|
||||||
- name: IMAGE
|
- name: OUTPUT
|
||||||
value: "$(params.image-name):$(tasks.fetch-repository.results.commit)"
|
value: >-
|
||||||
|
type=image,"name=$(params.image-name):latest,$(params.image-name):$(tasks.fetch-repository.results.commit)",push=true,compression=zstd,compression-level=22,oci-mediatypes=true
|
||||||
- name: CONTEXT
|
- name: CONTEXT
|
||||||
value: $(params.path-to-image-context)
|
value: $(params.path-to-image-context)
|
||||||
- name: DOCKERFILE
|
- name: DOCKERFILE
|
||||||
value: $(params.path-to-dockerfile)
|
value: $(params.path-to-dockerfile)
|
||||||
- name: BUILDER_IMAGE
|
|
||||||
value: "gcr.io/kaniko-project/executor:v1.12.1"
|
|
||||||
- name: EXTRA_ARGS
|
- name: EXTRA_ARGS
|
||||||
value:
|
value:
|
||||||
- "--target=$(params.target-name)"
|
- --import-cache
|
||||||
- --cache=true
|
- "type=registry,ref=$(params.image-name):buildcache"
|
||||||
- --cache-copy-layers
|
- --export-cache
|
||||||
- --cache-repo=harbor.fizz.buzz/kanikocache/cache
|
- "type=registry,ref=$(params.image-name):buildcache,mode=max,compression=zstd,compression-level=22,rewrite-timestamp=true,image-manifest=true,oci-mediatypes=true"
|
||||||
- --use-new-run # Should result in a speed-up
|
- --opt
|
||||||
- --reproducible # To remove timestamps so layer caching works.
|
- build-arg:SOURCE_DATE_EPOCH=$(tasks.get-git-commit-time.results.unix-time)
|
||||||
- --snapshot-mode=redo
|
- name: BUILDKITD_TOML
|
||||||
- --skip-unused-stages=true
|
value: |
|
||||||
- --registry-mirror=dockerhub.dockerhub.svc.cluster.local
|
debug = true
|
||||||
|
[registry."docker.io"]
|
||||||
|
mirrors = ["dockerhub.dockerhub.svc.cluster.local"]
|
||||||
|
[registry."dockerhub.dockerhub.svc.cluster.local"]
|
||||||
|
http = true
|
||||||
|
insecure = true
|
||||||
workspaces:
|
workspaces:
|
||||||
- name: source
|
- name: source
|
||||||
workspace: git-source
|
workspace: git-source
|
||||||
- name: dockerconfig
|
- name: dockerconfig
|
||||||
workspace: docker-credentials
|
workspace: docker-credentials
|
||||||
|
runAfter:
|
||||||
|
- fetch-repository
|
||||||
- name: run-cargo-clippy
|
- name: run-cargo-clippy
|
||||||
taskSpec:
|
taskSpec:
|
||||||
metadata: {}
|
metadata: {}
|
||||||
@ -153,7 +184,7 @@ spec:
|
|||||||
- build-image
|
- build-image
|
||||||
params:
|
params:
|
||||||
- name: docker-image
|
- name: docker-image
|
||||||
value: "$(params.image-name):$(tasks.fetch-repository.results.commit)"
|
value: "$(tasks.build-image.results.IMAGE_URL[1])"
|
||||||
finally:
|
finally:
|
||||||
- name: report-success
|
- name: report-success
|
||||||
when:
|
when:
|
||||||
@ -247,7 +278,7 @@ spec:
|
|||||||
workspace: cargo-cache
|
workspace: cargo-cache
|
||||||
params:
|
params:
|
||||||
- name: docker-image
|
- name: docker-image
|
||||||
value: "$(params.image-name):$(tasks.fetch-repository.results.commit)"
|
value: "$(tasks.build-image.results.IMAGE_URL[1])"
|
||||||
workspaces:
|
workspaces:
|
||||||
- name: git-source
|
- name: git-source
|
||||||
- name: docker-credentials
|
- name: docker-credentials
|
||||||
@ -277,4 +308,4 @@ spec:
|
|||||||
- name: path-to-image-context
|
- name: path-to-image-context
|
||||||
value: docker/organic_development/
|
value: docker/organic_development/
|
||||||
- name: path-to-dockerfile
|
- name: path-to-dockerfile
|
||||||
value: docker/organic_development/Dockerfile
|
value: docker/organic_development/
|
||||||
|
@ -69,41 +69,72 @@ spec:
|
|||||||
value: $(params.PULL_BASE_SHA)
|
value: $(params.PULL_BASE_SHA)
|
||||||
- name: deleteExisting
|
- name: deleteExisting
|
||||||
value: "true"
|
value: "true"
|
||||||
|
- name: get-git-commit-time
|
||||||
|
taskSpec:
|
||||||
|
metadata: {}
|
||||||
|
stepTemplate:
|
||||||
|
image: alpine:3.20
|
||||||
|
computeResources:
|
||||||
|
requests:
|
||||||
|
cpu: 10m
|
||||||
|
memory: 600Mi
|
||||||
|
workingDir: "$(workspaces.repo.path)"
|
||||||
|
results:
|
||||||
|
- name: unix-time
|
||||||
|
description: The time of the git commit in unix timestamp format.
|
||||||
|
steps:
|
||||||
|
- image: alpine/git:v2.34.2
|
||||||
|
name: detect-tag-step
|
||||||
|
script: |
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
set -euo pipefail
|
||||||
|
echo -n "$(git log -1 --pretty=%ct)" | tee $(results.unix-time.path)
|
||||||
|
workspaces:
|
||||||
|
- name: repo
|
||||||
|
workspace: git-source
|
||||||
|
runAfter:
|
||||||
|
- fetch-repository
|
||||||
- name: build-image
|
- name: build-image
|
||||||
taskRef:
|
taskRef:
|
||||||
resolver: git
|
resolver: git
|
||||||
params:
|
params:
|
||||||
- name: url
|
- name: url
|
||||||
value: https://code.fizz.buzz/mirror/catalog.git # mirror of https://github.com/tektoncd/catalog.git
|
value: https://code.fizz.buzz/talexander/personal_tekton_catalog.git
|
||||||
- name: revision
|
- name: revision
|
||||||
value: df36b3853a5657fd883015cdbf07ad6466918acf
|
value: 7ee31a185243ee6da13dcd26a592c585b64c80e5
|
||||||
- name: pathInRepo
|
- name: pathInRepo
|
||||||
value: task/kaniko/0.6/kaniko.yaml
|
value: task/buildkit-rootless-daemonless/0.1/buildkit-rootless-daemonless.yaml
|
||||||
params:
|
params:
|
||||||
- name: IMAGE
|
- name: OUTPUT
|
||||||
value: "$(params.image-name):$(tasks.fetch-repository.results.commit)"
|
value: >-
|
||||||
|
type=image,"name=$(params.image-name):latest,$(params.image-name):$(tasks.fetch-repository.results.commit)",push=true,compression=zstd,compression-level=22,oci-mediatypes=true
|
||||||
- name: CONTEXT
|
- name: CONTEXT
|
||||||
value: $(params.path-to-image-context)
|
value: $(params.path-to-image-context)
|
||||||
- name: DOCKERFILE
|
- name: DOCKERFILE
|
||||||
value: $(params.path-to-dockerfile)
|
value: $(params.path-to-dockerfile)
|
||||||
- name: BUILDER_IMAGE
|
|
||||||
value: "gcr.io/kaniko-project/executor:v1.12.1"
|
|
||||||
- name: EXTRA_ARGS
|
- name: EXTRA_ARGS
|
||||||
value:
|
value:
|
||||||
- "--target=$(params.target-name)"
|
- --import-cache
|
||||||
- --cache=true
|
- "type=registry,ref=$(params.image-name):buildcache"
|
||||||
- --cache-copy-layers
|
- --export-cache
|
||||||
- --cache-repo=harbor.fizz.buzz/kanikocache/cache
|
- "type=registry,ref=$(params.image-name):buildcache,mode=max,compression=zstd,compression-level=22,rewrite-timestamp=true,image-manifest=true,oci-mediatypes=true"
|
||||||
- --use-new-run # Should result in a speed-up
|
- --opt
|
||||||
- --reproducible # To remove timestamps so layer caching works.
|
- build-arg:SOURCE_DATE_EPOCH=$(tasks.get-git-commit-time.results.unix-time)
|
||||||
- --snapshot-mode=redo
|
- name: BUILDKITD_TOML
|
||||||
- --skip-unused-stages=true
|
value: |
|
||||||
- --registry-mirror=dockerhub.dockerhub.svc.cluster.local
|
debug = true
|
||||||
|
[registry."docker.io"]
|
||||||
|
mirrors = ["dockerhub.dockerhub.svc.cluster.local"]
|
||||||
|
[registry."dockerhub.dockerhub.svc.cluster.local"]
|
||||||
|
http = true
|
||||||
|
insecure = true
|
||||||
workspaces:
|
workspaces:
|
||||||
- name: source
|
- name: source
|
||||||
workspace: git-source
|
workspace: git-source
|
||||||
- name: dockerconfig
|
- name: dockerconfig
|
||||||
workspace: docker-credentials
|
workspace: docker-credentials
|
||||||
|
runAfter:
|
||||||
|
- fetch-repository
|
||||||
- name: run-cargo-test
|
- name: run-cargo-test
|
||||||
taskSpec:
|
taskSpec:
|
||||||
metadata: {}
|
metadata: {}
|
||||||
@ -152,7 +183,7 @@ spec:
|
|||||||
- build-image
|
- build-image
|
||||||
params:
|
params:
|
||||||
- name: docker-image
|
- name: docker-image
|
||||||
value: "$(params.image-name):$(tasks.fetch-repository.results.commit)"
|
value: "$(tasks.build-image.results.IMAGE_URL[1])"
|
||||||
finally:
|
finally:
|
||||||
- name: report-success
|
- name: report-success
|
||||||
when:
|
when:
|
||||||
@ -246,7 +277,7 @@ spec:
|
|||||||
workspace: cargo-cache
|
workspace: cargo-cache
|
||||||
params:
|
params:
|
||||||
- name: docker-image
|
- name: docker-image
|
||||||
value: "$(params.image-name):$(tasks.fetch-repository.results.commit)"
|
value: "$(tasks.build-image.results.IMAGE_URL[1])"
|
||||||
workspaces:
|
workspaces:
|
||||||
- name: git-source
|
- name: git-source
|
||||||
- name: docker-credentials
|
- name: docker-credentials
|
||||||
@ -276,4 +307,4 @@ spec:
|
|||||||
- name: path-to-image-context
|
- name: path-to-image-context
|
||||||
value: docker/organic_test/
|
value: docker/organic_test/
|
||||||
- name: path-to-dockerfile
|
- name: path-to-dockerfile
|
||||||
value: docker/organic_test/Dockerfile
|
value: docker/organic_test/
|
||||||
|
Loading…
Reference in New Issue
Block a user