1
0
mirror of https://github.com/tektoncd/catalog.git synced 2024-11-21 05:55:35 +00:00

Fix Result usage in Tasks

Some tasks were referencing absolute paths for `results`. It is recommended
to use variable replacement syntax in the API spec. This PR migrates the
absolute paths for results to variable syntax notation.
This commit is contained in:
Chitrang Patel 2023-05-16 13:07:54 -04:00 committed by tekton-robot
parent 835896be3d
commit f16be24141
18 changed files with 21 additions and 21 deletions

View File

@ -41,12 +41,12 @@ spec:
--state=free \
--target-state=busy)
echo $RESOURCE > /workspace/full-resource-output.json
echo $RESOURCE | jq -rj ".name" > /tekton/results/leased-resource
echo $RESOURCE | jq -rj ".name" > $(results.leased-resource.path)
- name: create-heartbeat-pod-yaml
image: docker.io/lachlanevenson/k8s-kubectl@sha256:3a5e22a406a109f4f26ec06b5f1f6a66ae0cd0e185bc28499eb7b7a3bbf1fe09
script: |
FULL_RESOURCE_OUTPUT=$(cat /workspace/full-resource-output.json)
LEASED_RESOURCE=$(cat /tekton/results/leased-resource)
LEASED_RESOURCE=$(cat $(results.leased-resource.path))
cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: Pod
@ -62,4 +62,4 @@ spec:
- --owner-name=$(params.owner-name)
- --resource=$FULL_RESOURCE_OUTPUT
- --period=5m
EOF
EOF

View File

@ -87,7 +87,7 @@ spec:
- name: digest-to-results
image: $(params.BUILDER_IMAGE)
script: cat $(workspaces.source.path)/image-digest | tee /tekton/results/IMAGE_DIGEST
script: cat $(workspaces.source.path)/image-digest | tee $(results.IMAGE_DIGEST.path)
volumes:
- name: varlibcontainers

View File

@ -89,7 +89,7 @@ spec:
- name: digest-to-results
image: $(params.BUILDER_IMAGE)
script: cat $(workspaces.source.path)/image-digest | tee /tekton/results/IMAGE_DIGEST
script: cat $(workspaces.source.path)/image-digest | tee $(results.IMAGE_DIGEST.path)
volumes:
- name: varlibcontainers

View File

@ -93,7 +93,7 @@ spec:
- name: digest-to-results
image: $(params.BUILDER_IMAGE)
script: cat $(workspaces.source.path)/image-digest | tee /tekton/results/IMAGE_DIGEST
script: cat $(workspaces.source.path)/image-digest | tee $(results.IMAGE_DIGEST.path)
volumes:
- name: varlibcontainers

View File

@ -107,4 +107,4 @@ spec:
--allow=tcp:22,tcp:80,tcp:8080,tcp:30000-32767,udp:30000-32767 \
--target-tags=$INSTANCE_TAG
printf $UNIQUE_NAME > /tekton/results/cluster-name
printf $UNIQUE_NAME > $(results.cluster-name.path)

View File

@ -97,7 +97,7 @@ spec:
- name: digest-to-results
image: $(params.BUILDER_IMAGE)
script: cat $(workspaces.source.path)/$(params.DIRECTORY)/image-digest | tee /tekton/results/IMAGE_DIGEST
script: cat $(workspaces.source.path)/$(params.DIRECTORY)/image-digest | tee $(results.IMAGE_DIGEST.path)
volumes:
- name: empty-dir-volume

View File

@ -101,7 +101,7 @@ spec:
- name: digest-to-results
image: $(params.BUILDER_IMAGE)
script: cat $(workspaces.source.path)/$(params.DIRECTORY)/image-digest | tee /tekton/results/IMAGE_DIGEST
script: cat $(workspaces.source.path)/$(params.DIRECTORY)/image-digest | tee $(results.IMAGE_DIGEST.path)
volumes:
- name: empty-dir-volume

View File

@ -67,7 +67,7 @@ spec:
- name: digest-to-results
image: $(params.MAVEN_IMAGE)
script: cat $(workspaces.source.path)/target/jib-image.digest | tee /tekton/results/IMAGE_DIGEST
script: cat $(workspaces.source.path)/target/jib-image.digest | tee $(results.IMAGE_DIGEST.path)
volumes:
- name: empty-dir-volume

View File

@ -77,7 +77,7 @@ spec:
- name: digest-to-results
image: $(params.MAVEN_IMAGE)
script: cat $(workspaces.source.path)/target/jib-image.digest | tee /tekton/results/IMAGE_DIGEST
script: cat $(workspaces.source.path)/target/jib-image.digest | tee $(results.IMAGE_DIGEST.path)
volumes:
- name: empty-dir-volume

View File

@ -77,7 +77,7 @@ spec:
- name: digest-to-results
image: $(params.MAVEN_IMAGE)
script: cat $(workspaces.source.path)/$(params.DIRECTORY)/target/jib-image.digest | tee /tekton/results/IMAGE_DIGEST
script: cat $(workspaces.source.path)/$(params.DIRECTORY)/target/jib-image.digest | tee $(results.IMAGE_DIGEST.path)
volumes:
- name: empty-dir-volume

View File

@ -73,4 +73,4 @@ spec:
workingDir: $(workspaces.source.path)
image: docker.io/stedolan/jq@sha256:a61ed0bca213081b64be94c5e1b402ea58bc549f457c2682a86704dd55231e09
script: |
cat $(params.CONTEXT)/image-digested | jq '.[0].value' -rj | tee /tekton/results/IMAGE-DIGEST
cat $(params.CONTEXT)/image-digested | jq '.[0].value' -rj | tee $(results.IMAGE-DIGEST.path)

View File

@ -72,4 +72,4 @@ spec:
workingDir: $(workspaces.source.path)
image: docker.io/stedolan/jq@sha256:a61ed0bca213081b64be94c5e1b402ea58bc549f457c2682a86704dd55231e09
script: |
cat $(params.CONTEXT)/image-digested | jq '.[0].value' -rj | tee /tekton/results/IMAGE-DIGEST
cat $(params.CONTEXT)/image-digested | jq '.[0].value' -rj | tee $(results.IMAGE-DIGEST.path)

View File

@ -72,4 +72,4 @@ spec:
workingDir: $(workspaces.source.path)
image: docker.io/stedolan/jq@sha256:a61ed0bca213081b64be94c5e1b402ea58bc549f457c2682a86704dd55231e09
script: |
cat $(params.CONTEXT)/image-digested | jq '.[0].value' -rj | tee /tekton/results/IMAGE-DIGEST
cat $(params.CONTEXT)/image-digested | jq '.[0].value' -rj | tee $(results.IMAGE-DIGEST.path)

View File

@ -77,4 +77,4 @@ spec:
workingDir: $(workspaces.source.path)
image: $(params.JQ_IMAGE)
script: |
cat $(params.CONTEXT)/image-digested | jq '.[0].value' -rj | tee /tekton/results/IMAGE-DIGEST
cat $(params.CONTEXT)/image-digested | jq '.[0].value' -rj | tee $(results.IMAGE-DIGEST.path)

View File

@ -54,7 +54,7 @@ spec:
- --dockerfile=$(params.DOCKERFILE)
- --context=$(workspaces.source.path)/$(params.CONTEXT) # The user does not need to care the workspace and the source.
- --destination=$(params.IMAGE)
- --digest-file=/tekton/results/IMAGE-DIGEST
- --digest-file=$(results.IMAGE-DIGEST.path)
# kaniko assumes it is running as root, which means this example fails on platforms
# that default to run containers as random uid (like OpenShift). Adding this securityContext
# makes it explicit that it needs to run as root.

View File

@ -16,7 +16,7 @@ spec:
set -xe
NUM=$(ls $(workspaces.pr.path)/comments | wc -l )
echo -n $NUM > /tekton/results/count
echo -n $NUM > $(results.count.path)
---
# TODO(pipeline#1986) Once we have some kind of "auto workspace mode" we can avoid
# having to manually create a PVC and manually clear it repeatedly
@ -45,4 +45,4 @@ spec:
script: |
#!/usr/bin/env bash
set -xe
rm -rf $(workspaces.w.path)/*
rm -rf $(workspaces.w.path)/*

View File

@ -82,7 +82,7 @@ spec:
name: varlibcontainers
- name: digest-to-results
image: $(params.BUILDER_IMAGE)
script: cat $(workspaces.source.path)/image-digest | tee /tekton/results/IMAGE_DIGEST
script: cat $(workspaces.source.path)/image-digest | tee $(results.IMAGE_DIGEST.path)
volumes:
- emptyDir: {}
name: varlibcontainers

View File

@ -71,7 +71,7 @@ spec:
[[ "$(workspaces.dockerconfig.bound)" == "true" ]] && export DOCKER_CONFIG="$(workspaces.dockerconfig.path)"
buildah ${CERT_DIR_FLAG} push --tls-verify=$(params.TLSVERIFY) --digestfile $(workspaces.source.path)/image-digest \
$(params.IMAGE) docker://$(params.IMAGE)
cat $(workspaces.source.path)/image-digest | tee /tekton/results/IMAGE_DIGEST
cat $(workspaces.source.path)/image-digest | tee $(results.IMAGE_DIGEST.path)
volumeMounts:
- name: varlibcontainers
mountPath: /var/lib/containers