diff --git a/pipelines/enterprise-contract.yaml b/pipelines/enterprise-contract.yaml index 40a2581896..4d0f80dc30 100644 --- a/pipelines/enterprise-contract.yaml +++ b/pipelines/enterprise-contract.yaml @@ -67,10 +67,10 @@ spec: type: string description: Reduce the Snapshot to only the component whose build caused the Snapshot to be created default: "false" - - name: PIPELINERUN_ID + - name: SINGLE_COMPONENT_CUSTOM_RESOURCE type: string description: PipelineRun ID - default: "$(context.pipelineRun.name)" + default: "pr/$(context.pipelineRun.name)" results: - name: TEST_OUTPUT value: "$(tasks.verify.results.TEST_OUTPUT)" @@ -101,6 +101,10 @@ spec: value: "$(params.CA_TRUST_CONFIGMAP_NAME)" - name: CA_TRUST_CONFIG_MAP_KEY value: "$(params.CA_TRUST_CONFIG_MAP_KEY)" + - name: SINGLE_COMPONENT + value: "$(params.SINGLE_COMPONENT)" + - name: SINGLE_COMPONENT_CUSTOM_RESOURCE + value: "$(params.SINGLE_COMPONENT_CUSTOM_RESOURCE)" taskRef: resolver: bundles params: diff --git a/task/reduce-snapshot-to-single-component/0.1/README.md b/task/reduce-snapshot-to-single-component/0.1/README.md deleted file mode 100644 index 8f660f2d36..0000000000 --- a/task/reduce-snapshot-to-single-component/0.1/README.md +++ /dev/null @@ -1,20 +0,0 @@ -# reduce-snapshot-to-single-component task - -This task is designed to reduce the Snapshot that is passed to the Enterprise Contract verify task. - -If activated via the SINGLE_COMPONENT parameter, then the Snapshot is filtered to only contain the Component which caused the Snapshot to be built. - -The use case for this reduction is based on the desire to have components that are built to be quickly released -regardless of any other Components within the Snapshot and Application. - -## Parameters -| name | description | default value | required | -|-----------------|------------------------------------------------------------------------------------------|---------------|------------| -| SNAPSHOT | Snapshot to possibly reduce | | true | -| SINGLE_COMPONENT | Reduce the Snapshot to only the component whose build caused the Snapshot to be created | false | false | -| PIPELINERUN_ID | Name of current PipelineRun. | | true | - -## Results -| name | description | -|----------|--------------------| -| SNAPSHOT | Resulting Snapshot | diff --git a/task/reduce-snapshot-to-single-component/0.1/reduce-snapshot-to-single-component.yaml b/task/reduce-snapshot-to-single-component/0.1/reduce-snapshot-to-single-component.yaml deleted file mode 100644 index c751df720d..0000000000 --- a/task/reduce-snapshot-to-single-component/0.1/reduce-snapshot-to-single-component.yaml +++ /dev/null @@ -1,59 +0,0 @@ ---- -apiVersion: tekton.dev/v1 -kind: Task -metadata: - name: reduce-snapshot-to-single-component - annotations: - tekton.dev/pipelines.minVersion: 0.0.1 - tekton.dev/tags: konflux - labels: - app.kubernetes.io/version: "0.1" - build.appstudio.redhat.com/build_type: docker -spec: - description: Reduce a snapshot to contain the single component that the snapshot was created for. - params: - - name: SNAPSHOT - description: Snapshot to possibly reduce - type: string - - name: SINGLE_COMPONENT - description: Reduce the Snapshot to only the component whose build caused the Snapshot to be created - type: string - default: false - - name: PIPELINERUN_ID - description: Name of current PipelineRun. - type: string - results: - - name: SNAPSHOT - description: Reduced Snapshot if SINGLE_COMPONENT == true otherwise the original Snapshot - steps: - - name: reduce-snapshot-to-single-component - image: quay.io/konflux-ci/appstudio-utils:ab6b0b8e40e440158e7288c73aff1cf83a2cc8a9@sha256:24179f0efd06c65d16868c2d7eb82573cce8e43533de6cea14fec3b7446e0b14 - env: - - name: SNAPSHOT - value: $(params.SNAPSHOT) - - name: SINGLE_COMPONENT - value: $(params.SINGLE_COMPONENT) - - name: PIPELINERUN_ID - value: $(params.PIPELINERUN_ID) - script: | - #!/usr/bin/env bash - set -eu - - echo "Single Component mode? ${SINGLE_COMPONENT}" - if [ "${SINGLE_COMPONENT}" == "true" ]; then - SNAPSHOT_CREATION_TYPE=$(oc get "pr/$PIPELINERUN_ID" -ojson | jq -rec '.metadata.labels."test.appstudio.openshift.io/type" // ""') - SNAPSHOT_CREATION_COMPONENT=$(oc get "pr/$PIPELINERUN_ID" -ojson | jq -rec '.metadata.labels."appstudio.openshift.io/component" // ""') - - echo "SNAPSHOT_CREATION_TYPE: ${SNAPSHOT_CREATION_TYPE}" - echo "SNAPSHOT_CREATION_COMPONENT: ${SNAPSHOT_CREATION_COMPONENT}" - if [ "${SNAPSHOT_CREATION_TYPE}" == "component" ] && [ "${SNAPSHOT_CREATION_COMPONENT}" != "" ]; then - echo "Single Component mode is ${SINGLE_COMPONENT} and Snapshot type is component" - REDUCED_SNAPSHOT=$(echo "${SNAPSHOT}" | jq --arg component "${SNAPSHOT_CREATION_COMPONENT}" \ - 'del(.components[] | select(.name != $component))') - echo "Reducing Snapshot to:" - echo "$REDUCED_SNAPSHOT" | jq . - SNAPSHOT=$(echo "$REDUCED_SNAPSHOT" | tr -d ' ' | tr -d '\n') - fi - fi - - echo "$SNAPSHOT" | tee -a "$(results.SNAPSHOT.path)" diff --git a/task/reduce-snapshot-to-single-component/OWNERS b/task/reduce-snapshot-to-single-component/OWNERS deleted file mode 100644 index 27203edec2..0000000000 --- a/task/reduce-snapshot-to-single-component/OWNERS +++ /dev/null @@ -1,5 +0,0 @@ -# See the OWNERS docs: https://go.k8s.io/owners -approvers: - - integration-team -reviewers: - - integration-team