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

[PM-15126] Third attempt: Remove reliance on secrets in build pipelines #13222

Merged
merged 23 commits into from
Feb 11, 2025

Conversation

coroiu
Copy link
Contributor

@coroiu coroiu commented Feb 3, 2025

This is a re-introduction of the original PR. The following is the original description:

📔 Objective

This PR changes how our CI workflows run so that they are able to run even without secrets. It also adds another another set of workflows that can be manually triggered by Bitwarden employees to build contributor PRs with full access to secrets if needed.

  • build-<app>.yml workflows now run on pull_request instead of pull_request_target, this means that:
    • When the PR originates from within Bitwarden it should have full access to all secrets
    • When the PR originates from outside Bitwarden it won't have any access to secrets
    • Because "external PRs" no longer have access to secrets we can safely triggers these automatically
  • build-<app>-target.yml have been added to let Bitwarden employees manually trigger build-<app>.yml using pull_request_target which gives it access to all the secrets
    • These workflows are protected from running when triggered by a contributor
    • These workflows are skipped when the PR originates from within Bitwarden
    • These are very simple workflows which just trigger the regular build-<app>.yml but with full inherited secrets
  • A nice consequence of this is that the workflows now also function in forks, even without access to secrets
  • All executions of these workflows generate and upload artifacts (in forks too)
    • Artifacts which require secrets for things like signing will not be generated when no secrets are available

Here is an example of these workflows running in a fork: coroiu#1

📸 Screenshots

⏰ Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Protected functional changes with optionality (feature flags)
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team

🦮 Reviewer guidelines

  • 👍 (:+1:) or similar for great changes
  • 📝 (:memo:) or ℹ️ (:information_source:) for notes or general info
  • ❓ (:question:) for questions
  • 🤔 (:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion
  • 🎨 (:art:) for suggestions / improvements
  • ❌ (:x:) or ⚠️ (:warning:) for more significant problems or concerns needing attention
  • 🌱 (:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt
  • ⛏ (:pick:) for minor or nitpick changes

@coroiu coroiu requested a review from a team as a code owner February 3, 2025 15:03
@coroiu
Copy link
Contributor Author

coroiu commented Feb 3, 2025

@justindbaur adding you as reviewer too because of how highly discussed this has been

Copy link
Contributor

github-actions bot commented Feb 3, 2025

Logo
Checkmarx One – Scan Summary & Details79051f70-e87f-4c6f-8802-ad78d6f3c3e6

Great job, no security vulnerabilities found in this Pull Request

Copy link

codecov bot commented Feb 3, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 35.20%. Comparing base (55c1dd9) to head (cadd475).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13222      +/-   ##
==========================================
- Coverage   35.21%   35.20%   -0.01%     
==========================================
  Files        3126     3126              
  Lines       92567    92567              
  Branches    16857    16857              
==========================================
- Hits        32597    32590       -7     
- Misses      57513    57520       +7     
  Partials     2457     2457              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@withinfocus
Copy link
Contributor

I'd say this is blocked from merging until bitwarden/renovate-config#18 is in.

@trmartin4
Copy link
Member

@coroiu the blocking PR has been merged 🥳 .

Copy link
Member

@justindbaur justindbaur left a comment

Choose a reason for hiding this comment

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

Just a question about passing inputs, otherwise everything looks good.

.github/workflows/build-browser-target.yml Show resolved Hide resolved
pull_request_target are only intended to be used with contributor PRs and we cannot dispatch builds for these branches so there was no point having that option.
@coroiu coroiu requested a review from justindbaur February 10, 2025 14:06
@coroiu coroiu merged commit 4cb8e85 into main Feb 11, 2025
134 checks passed
@coroiu coroiu deleted the PM-15126-third-attempt branch February 11, 2025 10:14
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

Successfully merging this pull request may close these issues.

4 participants