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

output the digest of the container image for further usage in flux push artifact command #3852

Closed
developer-guy opened this issue May 5, 2023 · 3 comments
Labels
area/oci OCI related issues and pull requests enhancement New feature or request good first issue Good for newcomers

Comments

@developer-guy
Copy link
Member

I've got an example of signing artifact pushed using flux push artifact command but to be able to do that I need to apply a workaround by using crane command, but we can add a new flag to output the digest to a file or stdout in flux push artifact command.

 # Create OCI artifact with kubernetes manifests
      - name: Create OCI artifact
        id: create-oci-artifact
        run: |
          flux push artifact $OCI_REPO:$(git rev-parse --short HEAD) \
            --path="./k8s" \
            --source="$(git config --get remote.origin.url)" \
            --revision="$(git branch --show-current)/$(git rev-parse HEAD)"
      # Tag OCI artifact
      - name: Create OCI artifact tag
        run: |
          flux tag artifact $OCI_REPO:$(git rev-parse --short HEAD) --tag main
      # Install Crane
      - uses: imjasonh/setup-crane@v0.3

      # Install Cosign
      - uses: sigstore/cosign-installer@main

      - name: Get the digest of the OCI artifact
        id: crane
        run: |
# Here we are applying a workaround to find the digest, instead we can output the digest in `create-oci-artifact` step.
          DIGEST=$(crane digest $GHCR_REPO:$(git rev-parse --short HEAD)) 
          echo "DIGEST=$DIGEST" >> $GITHUB_OUTPUT

      # Cosign the OCI artifact
      - name: Sign the OCI artifact
        run: cosign sign $GHCR_REPO@${{ steps.crane.outputs.DIGEST }} -y

/cc @stefanprodan

@developer-guy
Copy link
Member Author

I can take over this one!

@makkes makkes added enhancement New feature or request area/UX area/oci OCI related issues and pull requests good first issue Good for newcomers labels May 8, 2023
@stefanprodan
Copy link
Member

This was implemented in #3540

@developer-guy
Copy link
Member Author

thanks so much, I'm closing this one!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/oci OCI related issues and pull requests enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants