-
Notifications
You must be signed in to change notification settings - Fork 39
feat: add decryption passphrase for encrypted artifacts #762
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
Open
alesancor1
wants to merge
3
commits into
main
Choose a base branch
from
feat/decrypt-before-upload
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not just about this PR, but this other occurrence of a name assumption is making me nervous. Why couldn't we just have the
crypt-artifactaction output the name of the encrypted artifact (in previous workflows), and that would be the{{ inputs.artifcat_name}}passed across multiple workflows?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What you are suggesting is not really about
crypt-artifactaction, but about our logic forBuild.yaml:The artifact name is given as an input to
Build.yaml, so even ifcrypt-artifactoutputs the name of the encrypted file (which could also be a directory, in which case the output wouldn't be a single.gpgfile) you would then need to makeBuild.yamloutput that name so it can get passed down toTest.yamland thisupload-artifact.This would cause a big regression and impact any workflow using
Build.yaml. If we want to do this, we should then first tag our workflows.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't
crypt-artifactthe one taking in a file name, adding.gpgto it, and then creating the encrypted file? if so, it would be the action's job to tell the step what files it has created.the challenge here is that the action supports a dir as an input path, thus making the outputs a bit hard to read. i'm ok merging this as is, but IMO it's adding technical depth and I'd like to spend some minutes on it just in case there's an easy solution
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The uploaded artifact name does not necessarily need to be the name of the file to be decrypted, mainly because such artifact can be an entire directory (this is the case for single arch rocks in
Build.yaml).So
artifact-nameandinput-pathare two separate things: We could downloadartifact-nameto/foo/barand the file(s) to be decrypted would be/foo/bar/{artifact-name}.gpg, so theinput-pathfor the script would be/foo/bar.The real problem and reason why we have to make the assumption that it ends in
.gpgis because the encryption happens in a separate workflow (Build.yaml) and the name of the file (the one ended in.gpg) is not outputted by it.This also happens in
Test.yaml:oci-factory/.github/workflows/Test-Rock.yaml
Line 113 in 5876dfa
The correct solution here would be to have
Build.yamlset the output of what is the name of the artifact that was uploaded (if it's a directory, it would remain the same, if it's a single file it would contain.gpg) so you can pass that name to the other workflows. Havingcrypt-artifactoutput the name of the encrypted file/dir is just a step towards this.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I need a live walkthrough of this. can u pls schedule one?
In the meantime, let's start by looking at
oci-factory/.github/workflows/Build-Rock.yaml
Lines 323 to 336 in 5876dfa
${{ inputs.oci-archive-name }}into the action, to be encrypted${{ inputs.oci-archive-name }}.gpgfiles and deletes the original${{ inputs.oci-archive-name }}${{ inputs.oci-archive-name }}, but hasn't this been deleted?${{ inputs.oci-archive-name }}*Then:
oci-factory/.github/workflows/Image.yaml
Line 192 in 5876dfa
as you say, here you could use
needs.build-rock.outputs.oci-archive-nameThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note the glob
path: ${{ inputs.oci-archive-name }}*- that would take both.gpgand non.gpgfiles. This comes from #706 (comment)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If
crypt-artifactset the.gpgas the output, then we'd use that for upload, but we'd find trouble afterwards in other jobsTest,upload-rockwhen internally downloading and decrypting the artifact