-
Notifications
You must be signed in to change notification settings - Fork 667
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
Use configure-aws-credentials
workflow instead of passing secret_access_key
#1363
base: unstable
Are you sure you want to change the base?
Conversation
Signed-off-by: vudiep411 <vdiep@amazon.com>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## unstable #1363 +/- ##
============================================
- Coverage 70.62% 70.56% -0.06%
============================================
Files 117 117
Lines 63315 63315
============================================
- Hits 44714 44679 -35
- Misses 18601 18636 +35 |
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.
seems ok, @roshkhatri please take a look
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.
LGTM, just had a few questions.
@@ -11,6 +11,7 @@ on: | |||
required: true | |||
|
|||
permissions: | |||
id-token: write |
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.
Why do we need the write permissions here?
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.
This is to ensure that your workflow has the necessary permission to perform OIDC authentication with AWS.
|
||
permissions: | ||
id-token: write |
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.
why do we need write permissions here?
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.
Same as the comment above. Each job spawned in the matrix runs in a separate environment and each of this env needs permission to perform OIDC authentication with AWS.
- name: Install AWS cli. | ||
run: | | ||
sudo apt-get install -y awscli | ||
|
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.
Is the aws cli
installed by aws-actions/configure-aws-credentials@v4
??
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.
Yes, aws-actions/configure-aws-credentials@v4
will configured the runner environment with the proper AWS credentials and CLI
We will also need to do the prerequisites steps for the main repo before we merge this. |
@vudiep411, will it be possible to add a test, where we uploads a test build binary to a test s3 bucket when ever changes are made to these workflows. With this we can be sure that when we release stuff, it doesn't break on the main valkey repository |
Yes it is possible, we can use github environment for that. So we can write something like this:
We use env to dynamically assigned the role to assume and env. But this would required us to set up multiple OCID on different accounts not just in the workflow itself so it should be in a separate issue. For now we can just set this one up and after this looks good, I will open another issue for it if that's ok. |
I think we can also do it based on the github event trigger maybe?
Also, I think we should add the test on the same PR so we can run the test on this PR and know that the tests also work. We would also have to do the pre-requisites only once for both the scenarios. |
That's a really good suggestion. We can look into that. That way it would automated the testing of a PR with a test bucket. Definitely doable |
Summary
This PR fixes #1346 where we can get rid of the long term credentials by using OpenID Connect. OpenID Connect (OIDC) allows your GitHub Actions workflows to access resources in Amazon Web Services (AWS), without needing to store the AWS credentials as long-lived GitHub secrets.
Changes
We can remove these secrets that were passed in previously:
Instead we only need the
role-to-assume
arn. For more information OIDC.Prerequisites
Before merging this PR, we need to make sure to set up the proper Identity providers on the production AWS account. Follow this guides.
Quick guide:
Provider url:
https://token.actions.githubusercontent.com
Audience:
sts.amazonaws.com
Results
Github action run:
Files in S3 Dev env: