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

Expansion of environment variables as part of subject-paths does not work #146

Closed
sschuberth opened this issue Jul 4, 2024 · 2 comments
Closed

Comments

@sschuberth
Copy link

We have a job-global environment variable that is successfully used in other build steps, but that does not get expanded as part of defined subject-paths, see this error.

Is some special syntax required, or is this another restriction of actions/glob?

sschuberth added a commit to oss-review-toolkit/ort that referenced this issue Jul 4, 2024
Work around another restriction of the build attestation action, see
[1].

[1]: actions/attest-build-provenance#146

Signed-off-by: Sebastian Schuberth <[email protected]>
sschuberth added a commit to oss-review-toolkit/ort that referenced this issue Jul 4, 2024
Work around another restriction of the build attestation action, see
[1].

[1]: actions/attest-build-provenance#146

Signed-off-by: Sebastian Schuberth <[email protected]>
@bdehamer
Copy link
Collaborator

bdehamer commented Jul 8, 2024

When you have a job step which invokes a command using run you're running an instruction within a bash shell and get all of the features of the shell like environment variable expansion:

run: |
  gh release create $ORT_VERSION --notes-file RELEASE_NOTES.md \
      ./cli/build/distributions/ort-$ORT_VERSION.{tgz,zip}* \
      ./helper-cli/build/distributions/orth-$ORT_VERSION.{tgz,zip}*

When you invoke something like actions/attest-build-provenance with uses you're simply passing parameters to command and don't have the features of the bash shell available. However, you can still access environment variables using the Actions expression syntax:

- name: Attest Build Provenance
   uses: actions/attest-build-provenance@v1
   with:
     subject-path: |
       ./cli/build/distributions/ort-${{ env.ORT_VERSION }}.tgz
       ./cli/build/distributions/ort-${{ env.ORT_VERSION }}.zip
       ./helper-cli/build/distributions/orth-${{ env.ORT_VERSION }}.tgz
       ./helper-cli/build/distributions/orth-${{ env.ORT_VERSION }}.zip

@sschuberth
Copy link
Author

My bad, you're right, thanks @bdehamer!

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

No branches or pull requests

2 participants