Compare commits
1 Commits
main
...
preserve_c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ab59c05f09 |
@@ -22,6 +22,10 @@ spec:
|
|||||||
description: Includes credentials for the docker image registry.
|
description: Includes credentials for the docker image registry.
|
||||||
optional: true
|
optional: true
|
||||||
mountPath: /home/user/.docker
|
mountPath: /home/user/.docker
|
||||||
|
- name: buildkit-cache
|
||||||
|
description: For preserving buildkit type=cache mounts between builds.
|
||||||
|
optional: true
|
||||||
|
mountPath: /home/user/.local/share/buildkit
|
||||||
params:
|
params:
|
||||||
- name: OUTPUT
|
- name: OUTPUT
|
||||||
type: string
|
type: string
|
||||||
@@ -40,7 +44,8 @@ spec:
|
|||||||
- name: BUILDER_IMAGE
|
- name: BUILDER_IMAGE
|
||||||
type: string
|
type: string
|
||||||
description: Docker image containing BuildKit.
|
description: Docker image containing BuildKit.
|
||||||
default: "moby/buildkit:v0.29.0-rootless"
|
default: "moby/buildkit:v0.17.0-rc1-rootless"
|
||||||
|
# or v0.16.0-rootless
|
||||||
- name: EXTRA_ARGS
|
- name: EXTRA_ARGS
|
||||||
type: array
|
type: array
|
||||||
description: Arguments passed to the build command.
|
description: Arguments passed to the build command.
|
||||||
@@ -56,13 +61,23 @@ spec:
|
|||||||
description: Full URL to the docker image.
|
description: Full URL to the docker image.
|
||||||
type: array
|
type: array
|
||||||
volumes:
|
volumes:
|
||||||
- name: buildkitd
|
|
||||||
emptyDir: {}
|
|
||||||
- name: buildkitd-toml
|
- name: buildkitd-toml
|
||||||
emptyDir: {}
|
emptyDir: {}
|
||||||
- name: metadata-out
|
- name: metadata-out
|
||||||
emptyDir: {}
|
emptyDir: {}
|
||||||
steps:
|
steps:
|
||||||
|
- name: setup-cache-ownership
|
||||||
|
image: $(params.BUILDER_IMAGE)
|
||||||
|
workingDir: "$(workspaces.source.path)"
|
||||||
|
script: |
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
set -euo pipefail
|
||||||
|
chown 1000:1000 /home/user/.local/share/buildkit
|
||||||
|
chmod 0777 /home/user/.local/share/buildkit
|
||||||
|
securityContext:
|
||||||
|
runAsNonRoot: false
|
||||||
|
runAsUser: 0
|
||||||
|
runAsGroup: 0
|
||||||
- name: write-config
|
- name: write-config
|
||||||
image: $(params.BUILDER_IMAGE)
|
image: $(params.BUILDER_IMAGE)
|
||||||
workingDir: "$(workspaces.source.path)"
|
workingDir: "$(workspaces.source.path)"
|
||||||
@@ -86,8 +101,6 @@ spec:
|
|||||||
EOF
|
EOF
|
||||||
chmod +x /home/user/.config/buildkit/entrypoint.sh
|
chmod +x /home/user/.config/buildkit/entrypoint.sh
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: buildkitd
|
|
||||||
mountPath: /home/user/.local/share/buildkit
|
|
||||||
- name: buildkitd-toml
|
- name: buildkitd-toml
|
||||||
mountPath: /home/user/.config/buildkit
|
mountPath: /home/user/.config/buildkit
|
||||||
securityContext:
|
securityContext:
|
||||||
@@ -111,8 +124,6 @@ spec:
|
|||||||
- /home/user/.metadata/build.json
|
- /home/user/.metadata/build.json
|
||||||
- $(params.EXTRA_ARGS)
|
- $(params.EXTRA_ARGS)
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: buildkitd
|
|
||||||
mountPath: /home/user/.local/share/buildkit
|
|
||||||
- name: buildkitd-toml
|
- name: buildkitd-toml
|
||||||
mountPath: /home/user/.config/buildkit
|
mountPath: /home/user/.config/buildkit
|
||||||
readOnly: true
|
readOnly: true
|
||||||
|
|||||||
@@ -1,60 +0,0 @@
|
|||||||
apiVersion: tekton.dev/v1
|
|
||||||
kind: Task
|
|
||||||
metadata:
|
|
||||||
name: git-clone
|
|
||||||
labels:
|
|
||||||
app.kubernetes.io/version: "0.1"
|
|
||||||
annotations:
|
|
||||||
tekton.dev/categories: SCM
|
|
||||||
tekton.dev/pipelines.minVersion: "1.12.1"
|
|
||||||
tekton.dev/tags: scm
|
|
||||||
tekton.dev/displayName: "Clone a git repository."
|
|
||||||
tekton.dev/platforms: "linux/amd64"
|
|
||||||
spec:
|
|
||||||
description: >-
|
|
||||||
This task will clone a git repository.
|
|
||||||
workspaces:
|
|
||||||
- name: output
|
|
||||||
mountPath: /output
|
|
||||||
readOnly: false
|
|
||||||
params:
|
|
||||||
- name: url
|
|
||||||
type: string
|
|
||||||
description: The repository url to clone.
|
|
||||||
- name: revision
|
|
||||||
type: string
|
|
||||||
description: The revision to clone.
|
|
||||||
- name: IMAGE
|
|
||||||
type: string
|
|
||||||
description: Docker image to use for performing the clone.
|
|
||||||
default: "alpine/git:v2.54.0"
|
|
||||||
results:
|
|
||||||
- name: commit
|
|
||||||
type: string
|
|
||||||
description: The commit hash that was cloned.
|
|
||||||
- name: url
|
|
||||||
type: string
|
|
||||||
description: The URL to the git repo.
|
|
||||||
- name: committer-date
|
|
||||||
type: string
|
|
||||||
description: The time of the git commit in unix timestamp format.
|
|
||||||
steps:
|
|
||||||
- name: fetch-repository-step
|
|
||||||
image: $(params.IMAGE)
|
|
||||||
workingDir: "$(workspaces.output.path)"
|
|
||||||
script: |
|
|
||||||
#!/usr/bin/env sh
|
|
||||||
set -euo pipefail
|
|
||||||
export GIT_SSH_COMMAND="ssh -o StrictHostKeyChecking=accept-new"
|
|
||||||
git init --initial-branch=main
|
|
||||||
git remote add origin $(params.url)
|
|
||||||
git fetch -v origin $(params.revision)
|
|
||||||
git checkout FETCH_HEAD
|
|
||||||
|
|
||||||
git rev-parse HEAD > $(results.commit.path)
|
|
||||||
echo "$(params.url)" > $(results.url.path)
|
|
||||||
echo -n "$(git log -1 --pretty=%ct)" > $(results.committer-date.path)
|
|
||||||
# securityContext:
|
|
||||||
# runAsNonRoot: true
|
|
||||||
# runAsUser: 1000
|
|
||||||
# runAsGroup: 1000
|
|
||||||
Reference in New Issue
Block a user