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

Use OIDC to securely connect CircleCI to AWS #5589

Merged
merged 16 commits into from
May 8, 2023

Conversation

eternaltyro
Copy link
Collaborator

This PR introduces OpenID Connect for CircleCI to access AWS. Only jobs running inside a context can fetch AWS credentials. AWS provides temporary (30 min) access tokens for CircleCI to use for running AWS API ops.

Note:

  1. The duration of access token validity can be increased later if necessary
  2. The permissions associated with the ephemeral tokens are defined in the IAM role specified in config.yml. If more permissions are needed, we can of course add them to the IAM role

Benefits:

This obsoletes the need to specify an AWS key pair - risking them to exposure. This is a security measure primarily and to an extent a convenience measure to ease-up improvements to CircleCI config later.

Copy link
Contributor

@Aadesh-Baral Aadesh-Baral left a comment

Choose a reason for hiding this comment

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

I went through the PR, and I have a few questions.

  1. What is frontend-modern job used for?
  2. In frontend and backend deploy jobs, what function does the frontend-modern job play?
  3. I saw that frontend-modern was using a cimg/node:lts image, and I believe that the TM frontend build is not successful in node >=18.

@HelNershingThapa HelNershingThapa removed their request for review February 16, 2023 11:48
@eternaltyro
Copy link
Collaborator Author

Thanks for the review, @Aadesh-Baral

1. What is frontend-modern job used for?

It's an experimental job I used to play around with different settings. I will remove it in a subsequent commit. But for now it stays because I can work with CircleCI without clobbering on others' work.

2. In frontend and backend deploy jobs, what function does the frontend-modern job play?

Doesn't play any role. It's an independent workflow.

3. I saw that frontend-modern was using a cimg/node:lts image, and I believe that the TM frontend build is not successful in node >=18.

This is a discussion for later. But we need to get TM frontend to work with LTS releases as we move forward. I can switch the version to cimg/node:14.21 if my experiments fail.

eternaltyro and others added 6 commits February 16, 2023 13:13
- Legacy webhooks for sending notifications from CircleCI have been
  deprecated
- Orbs or Webhooks v2 are the recommended(?) way to go for sending
  notifications about CircleCI jobs /workflows to Opsgenie
- Removed the legacy notification lines from CircleCI config.yml
- Added OpsGenie orb (v1.0.8 last updated 2019)
- Added OPSGENIE_WEBHOOK envvar to org-global context and added context
  to workflows
- Added post-steps in workflows to send notifications to OpsGenie

[SECURITY]
- Enabled execution of uncertified orbs in CircleCI org settings
@sonarcloud
Copy link

sonarcloud bot commented Mar 2, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@eternaltyro
Copy link
Collaborator Author

Related to #5539

@dakotabenjamin
Copy link
Member

@eternaltyro is this still relevant to review?

@eternaltyro
Copy link
Collaborator Author

@dakotabenjamin yes, please. I will resolve the conflicts, but for now, can you review for any pitfalls and things like that?

@eternaltyro
Copy link
Collaborator Author

@dakotabenjamin I have resolved the conflicts. Please review once. If all is good, I'll merge this and then move on to improving the syntax further.

Copy link
Member

@dakotabenjamin dakotabenjamin left a comment

Choose a reason for hiding this comment

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

I love how we have separated out the jobs in this new workflow. LGTM, but I have a question: will splitting out some of these jobs into separate containers significantly increase overall runtime or storage capacity? Since they have different base images

@eternaltyro
Copy link
Collaborator Author

eternaltyro commented May 5, 2023

will splitting out some of these jobs into separate containers significantly increase overall runtime or storage capacity? Since they have different base images

@dakotabenjamin Those different tests don't save anything to cache. I don't think there will be a significant increase in project storage usage through saved caches.

Re: Runtime - it actually reduces the runtime because the tests are parallelised. There is no change in overall runtime since the build flows are dependent on the test flows and it is all sequential. I have ideas to shorten that too. I will increase the OIDC key lifetime to 45min in the interim.

Do you think this PR is good to be merged?

@sonarcloud
Copy link

sonarcloud bot commented May 8, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@eternaltyro eternaltyro merged commit 4755559 into develop May 8, 2023
@eternaltyro eternaltyro deleted the enhance/circleci-oidc branch May 8, 2023 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants