Browse Source

k8s manifests

gitops
Nicolas Massé 3 years ago
parent
commit
0a269a87b1
  1. 0
      k8s/buildconfig.yaml
  2. 5
      k8s/imagestream.yaml
  3. 8
      k8s/pipeline.yaml
  4. 15
      k8s/task-buildah.yaml
  5. 3
      k8s/task-git-clone.yaml

0
k8s/buildconfig.yaml

5
k8s/imagestream.yaml

@ -0,0 +1,5 @@
kind: ImageStream
apiVersion: image.openshift.io/v1
metadata:
name: function
spec:

8
k8s/pipeline.yaml

@ -6,11 +6,6 @@ spec:
workspaces: workspaces:
- name: scratch - name: scratch
params: params:
- name: buildahPlatforms
type: array
default:
- linux/x86_64
- linux/arm64/v8
- name: gitRepositoryURL - name: gitRepositoryURL
type: string type: string
- name: outputContainerImage - name: outputContainerImage
@ -38,9 +33,6 @@ spec:
value: latest value: latest
- name: outputContainerImage - name: outputContainerImage
value: "$(params.outputContainerImage)" value: "$(params.outputContainerImage)"
- name: buildahPlatforms
value:
- "$(params.buildahPlatforms[*])"
workspaces: workspaces:
- name: src - name: src
workspace: scratch workspace: scratch

15
k8s/task-buildah.yaml

@ -8,6 +8,9 @@ spec:
type: string type: string
- name: outputContainerImage - name: outputContainerImage
type: string type: string
results:
- name: imageDigest
description: The digest of the built image manifest
workspaces: workspaces:
- name: src - name: src
mountPath: /src mountPath: /src
@ -18,6 +21,8 @@ spec:
image: quay.io/containers/buildah:$(params.buildahVersion) image: quay.io/containers/buildah:$(params.buildahVersion)
workingDir: /src workingDir: /src
env: env:
- name: RESULT_IMAGE_DIGEST
value: "$(results.imageDigest.path)"
- name: TARGET_IMAGE - name: TARGET_IMAGE
value: "$(params.outputContainerImage)" value: "$(params.outputContainerImage)"
securityContext: securityContext:
@ -32,7 +37,7 @@ spec:
function build () { function build () {
echo "=========================================================" echo "========================================================="
echo " buildah build $TARGET_IMAGE echo " buildah build $TARGET_IMAGE"
echo "=========================================================" echo "========================================================="
echo echo
@ -50,7 +55,13 @@ spec:
echo " buildah push $1" echo " buildah push $1"
echo "=========================================================" echo "========================================================="
echo echo
buildah manifest push --storage-driver vfs --all tekton "docker://$1"
# buildah requires a slight modification to the push secret provided by the service
# account to use it for pushing the image
cp /var/run/secrets/openshift.io/push/.dockercfg /tmp
echo "{ \"auths\": $(cat /var/run/secrets/openshift.io/push/.dockercfg) }" > /tmp/.dockercfg
buildah manifest push --storage-driver vfs --all tekton "docker://$1" --digestfile "$RESULT_IMAGE_DIGEST" --tls-verify=false --authfile /tmp/.dockercfg
echo echo
} }

3
k8s/task-git-clone.yaml

@ -163,9 +163,6 @@ spec:
value: $(workspaces.ssl-ca-directory.bound) value: $(workspaces.ssl-ca-directory.bound)
- name: WORKSPACE_SSL_CA_DIRECTORY_PATH - name: WORKSPACE_SSL_CA_DIRECTORY_PATH
value: $(workspaces.ssl-ca-directory.path) value: $(workspaces.ssl-ca-directory.path)
securityContext:
runAsNonRoot: true
runAsUser: 65532
script: | script: |
#!/usr/bin/env sh #!/usr/bin/env sh
set -eu set -eu

Loading…
Cancel
Save