Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(RELEASE-1387): use trusted artifacts #784

Open
wants to merge 1 commit into
base: development
Choose a base branch
from

Conversation

scoheb
Copy link
Collaborator

@scoheb scoheb commented Jan 23, 2025

Describe your changes

Summary:

  • collect-data, reduce-snapshot, apply-mapping now support trusted
    artifacts mode
  • pipelines that use apply-mapping have had the workspace used for
    the apply-mapping task renamed to be in line with other tasks.
  • CI changes:
    • it now attempts to detect if a Trusted Artifacts based task
      has been changes and runs the tests with trusted artifacts enabled.
    • tests now create an on-local-cluster registry.

requires konflux-ci/release-service#666 for use on real clusters

Relevant Jira

Checklist before requesting a review

  • I have marked as draft or added do not merge label if there's a dependency PR
    • If you want reviews on your draft PR, you can add reviewers or add the release-service-maintainers handle if you are unsure who to tag
  • My commit message includes Signed-off-by: My name <email>
  • I have bumped the task/pipeline version string and updated changelog in the relevant README
  • I read CONTRIBUTING.MD and commit formatting

Copy link

openshift-ci bot commented Jan 23, 2025

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@scoheb scoheb force-pushed the use-trusted-artifacts branch 28 times, most recently from c5831b5 to 92310a3 Compare January 28, 2025 18:28
@scoheb scoheb force-pushed the use-trusted-artifacts branch 4 times, most recently from 7764841 to b8b89bc Compare February 3, 2025 18:40
@scoheb scoheb changed the title feat: use trusted artifacts feat(RELEASE-1291): use trusted artifacts Feb 3, 2025
@scoheb scoheb marked this pull request as ready for review February 3, 2025 18:43
@scoheb scoheb requested a review from a team as a code owner February 3, 2025 18:43
@scoheb scoheb requested a review from mmalina February 3, 2025 18:48
@scoheb scoheb changed the title feat(RELEASE-1291): use trusted artifacts feat(RELEASE-1387): use trusted artifacts Feb 4, 2025
@scoheb scoheb force-pushed the use-trusted-artifacts branch 4 times, most recently from 4adff68 to 8779560 Compare February 12, 2025 01:35
@scoheb scoheb force-pushed the use-trusted-artifacts branch from 8779560 to 09144e8 Compare February 18, 2025 01:28
@@ -353,3 +391,29 @@ spec:
"${SNAPSHOT_SPEC_FILE}" > /tmp/temp && mv /tmp/temp "${SNAPSHOT_SPEC_FILE}"
fi
done
- name: create-trusted-artifact
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first step says we will skip trusted-artifacts steps if the param is empty, but I don't see any when condition on this step. Is that intended?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems you cannot guard Steps from execution ... only Tasks in a Pipeline

the mechanism for skipping involves creating a skip file in the extract or create directory.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha. I think it may be helpful to add like a # this step does nothing is a .skip-trusted-artifacts file exists or something (assuming that is accurate) as that is not at all obvious to me

@scoheb scoheb force-pushed the use-trusted-artifacts branch 3 times, most recently from e43cbd8 to 918991a Compare February 25, 2025 15:16

prepare_docker_config() {
authString=$(echo -n "root:root" | base64 -w0)
cat > "/tmp/.dockerconfig.json" <<EOF
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any consideration of using a mktemp here instead of a static file?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, but (and this relates to my now resolved comment) couldn't you just call the export in the deploy_registry.sh script instead of test_tekton_tasks.sh? Then you wouldn't need to know where the file is in test_tekton_tasks.sh. It seems like it would be a bit more self contained that way, but it is mostly a nit pick anyways

@scoheb scoheb force-pushed the use-trusted-artifacts branch 5 times, most recently from 4aa7a92 to 52074e0 Compare February 26, 2025 21:28
@scoheb scoheb requested a review from johnbieren February 26, 2025 21:48
- in an effort to move away from PVCs, we are trying
  trusted artifacts based on:
  https://github.com/konflux-ci/build-trusted-artifacts/tree/main
- tasks that have been updated now support 2 modes:
  - PVC based workspaces
  - Trusted artifacts with emptyDir workspaces

Summary:
- collect-data, reduce-snapshot, apply-mapping now support trusted
  artifacts mode
- pipelines that use apply-mapping have had the workspace used for
  the apply-mapping task renamed to be in line with other tasks.
- CI changes:
  - it now attempts to detect if a Trusted Artifacts based task
    has been changes and runs the tests with trusted artifacts enabled.
  - tests now create an on-local-cluster registry.

Signed-off-by: Scott Hebert <scoheb@gmail.com>
@scoheb scoheb force-pushed the use-trusted-artifacts branch from 52074e0 to a9f87cc Compare February 27, 2025 14:17
@@ -22,22 +22,62 @@ spec:
type: string
description: Fail the task if the resulting snapshot contains 0 components
default: "false"
- name: ociStorage
description: The OCI repository where the Trusted Artifacts are stored.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit - period at end (already removed in README after other comment)

default: "empty"
- name: ociArtifactExpiresAfter
description: Expiration date for the trusted artifacts created in the
OCI repository. An empty string means the artifacts do not expire.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit - period at end (already removed in README after other comment)


prepare_docker_config() {
authString=$(echo -n "root:root" | base64 -w0)
cat > "/tmp/.dockerconfig.json" <<EOF
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, but (and this relates to my now resolved comment) couldn't you just call the export in the deploy_registry.sh script instead of test_tekton_tasks.sh? Then you wouldn't need to know where the file is in test_tekton_tasks.sh. It seems like it would be a bit more self contained that way, but it is mostly a nit pick anyways

@@ -353,3 +391,29 @@ spec:
"${SNAPSHOT_SPEC_FILE}" > /tmp/temp && mv /tmp/temp "${SNAPSHOT_SPEC_FILE}"
fi
done
- name: create-trusted-artifact
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha. I think it may be helpful to add like a # this step does nothing is a .skip-trusted-artifacts file exists or something (assuming that is accurate) as that is not at all obvious to me

@@ -10,22 +10,36 @@ spec:
for the component.
workspaces:
- name: tests-workspace
params:
- name: ociStorage
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the way this works is the test script file injects this parameter based on what mode it is being called in, right? Pretty clever

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why doesn't this task need

    - name: patch-source-data-artifact-result
      image: quay.io/konflux-ci/release-service-utils:e633d51cd41d73e4b3310face21bb980af7a662f
      script: |
        #!/usr/bin/env bash
        set -eu
        # this is needed to skip trusted-artifacts tasks
        # when using PVC based workspaces.
        if [ "$(params.ociStorage)" == "empty" ]; then
          echo -n "$(params.ociStorage)" > "$(results.sourceDataArtifact.path)"
        fi

?

- name: sourceDataArtifact
type: string
default: ""
- name: subdirectory
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remind me why this task needs this param when collect-data already outputs each file in a subdir?

@@ -72,6 +81,12 @@ spec:
- name: releasePipelineMetadata
type: string
description: json object containing git resolver metadata about the running release pipeline
- description: Produced trusted data artifact
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's better to use the same attribute order with the previous params.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants