diff --git a/pipelines/integration-test/ansible-upgrade.yaml b/pipelines/integration-test/ansible-upgrade.yaml index b5a5698d..8e84d126 100644 --- a/pipelines/integration-test/ansible-upgrade.yaml +++ b/pipelines/integration-test/ansible-upgrade.yaml @@ -57,31 +57,23 @@ spec: - name: prepare-molecule-tests runAfter: - clone-source-code + taskRef: + resolver: git + params: + - name: url + value: https://github.com/securesign/pipelines.git + - name: revision + value: eli/dupeCode + - name: pathInRepo + value: tasks/integration-test/prepare-molecule-tests.yaml + params: + - name: container-image + value: $(tasks.parse-metadata.results.container-image) + - name: ansible-path + value: "ansible" workspaces: - name: work workspace: work - taskSpec: - workspaces: - - name: work - steps: - - name: extract-release-image-content - image: "gcr.io/go-containerregistry/crane" - args: - - export - - $(tasks.parse-metadata.results.container-image) - - $(workspaces.work.path)/image.tar - - name: prepare-tests - image: "quay.io/redhat-appstudio/konflux-test:stable" - script: | - #!/bin/sh - set -ex - - # extract the release image content - tar xf $(workspaces.work.path)/image.tar -C $(workspaces.work.path) - - # replace the tas_single_node name with the redhat.artifact_signer.tas_single_node name - find $(workspaces.work.path)/ansible/molecule -type f -name "converge.yml" \ - -exec sed -i 's@name: tas_single_node@name: redhat.artifact_signer.tas_single_node@g' {} + - name: run-upgrade-test runAfter: - prepare-molecule-tests diff --git a/pipelines/integration-test/ansible.yaml b/pipelines/integration-test/ansible.yaml index 36261e18..edd5b900 100644 --- a/pipelines/integration-test/ansible.yaml +++ b/pipelines/integration-test/ansible.yaml @@ -78,31 +78,23 @@ spec: - name: output workspace: work - name: prepare-molecule-tests + taskRef: + resolver: git + params: + - name: url + value: https://github.com/securesign/pipelines.git + - name: revision + value: eli/dupeCode + - name: pathInRepo + value: tasks/integration-test/prepare-molecule-tests.yaml + params: + - name: container-image + value: $(tasks.parse-metadata.results.container-image) + - name: ansible-path + value: "artifact-signer-ansible" workspaces: - name: work workspace: work - taskSpec: - workspaces: - - name: work - steps: - - name: extract-release-image-content - image: "gcr.io/go-containerregistry/crane" - args: - - export - - $(tasks.parse-metadata.results.container-image) - - $(workspaces.work.path)/image.tar - - name: prepare-env - image: "quay.io/redhat-appstudio/konflux-test:stable" - script: | - #!/bin/sh - set -ex - - # extract the release image content - tar xf $(workspaces.work.path)/image.tar -C $(workspaces.work.path) - - # replace the tas_single_node name with the redhat.artifact_signer.tas_single_node name - find $(workspaces.work.path)/artifact-signer-ansible/molecule -type f -name "converge.yml" \ - -exec sed -i 's@name: tas_single_node@name: redhat.artifact_signer.tas_single_node@g' {} + - name: run-molecule-tests runAfter: - prepare-molecule-tests @@ -121,7 +113,7 @@ spec: - name: url value: https://github.com/securesign/pipelines.git - name: revision - value: main + value: eli/dupeCode - name: pathInRepo value: tasks/integration-test/ansible/run-molecule-tests.yaml - name: run-sigstore-e2e-tests @@ -140,7 +132,7 @@ spec: - name: url value: https://github.com/securesign/pipelines.git - name: revision - value: main + value: eli/dupeCode - name: pathInRepo value: tasks/integration-test/ansible/run-sigstore-e2e-tests.yaml finally: diff --git a/tasks/integration-test/prepare-molecule-tests.yaml b/tasks/integration-test/prepare-molecule-tests.yaml new file mode 100644 index 00000000..1c0e5d40 --- /dev/null +++ b/tasks/integration-test/prepare-molecule-tests.yaml @@ -0,0 +1,41 @@ +apiVersion: tekton.dev/v1 +kind: Task +metadata: + name: prepare-molecule-tests +spec: + description: | + Extracts a container image and prepares the Ansible molecule test environment + by replacing role names in converge.yml files. + params: + - name: container-image + type: string + description: The container image URL to extract (e.g., from Snapshot) + - name: ansible-path + type: string + description: Path to the Ansible directory relative to workspace (e.g., "ansible" or "artifact-signer-ansible") + default: "ansible" + workspaces: + - name: work + description: Workspace where the image will be extracted and processed + steps: + - name: extract-release-image-content + image: "gcr.io/go-containerregistry/crane" + args: + - export + - $(params.container-image) + - $(workspaces.work.path)/image.tar + - name: prepare-env + image: "quay.io/redhat-appstudio/konflux-test:stable" + script: | + #!/bin/sh + set -ex + + # Extract the release image content + tar xf $(workspaces.work.path)/image.tar -C $(workspaces.work.path) + + # Replace the tas_single_node name with the redhat.artifact_signer.tas_single_node name + # This finds all converge.yml files in the molecule directory and updates the role name + find $(workspaces.work.path)/$(params.ansible-path)/molecule -type f -name "converge.yml" \ + -exec sed -i 's@name: tas_single_node@name: redhat.artifact_signer.tas_single_node@g' {} + + + echo "Successfully prepared molecule tests in $(params.ansible-path)"