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
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
7610cd1
feat: create copy of desktop build for PR target
coroiu Dec 4, 2024
4b9d563
chore: add temporary file to trigger ci
coroiu Dec 4, 2024
336ccf1
fix: remove check-run from regular desktop build
coroiu Dec 4, 2024
efcfe4d
feat: change browser build to not use pr target
coroiu Dec 5, 2024
32e0915
fix: skip build-safari if secret is not available
coroiu Dec 6, 2024
d0afb49
feat: skip safari build if secrets are not available
coroiu Dec 6, 2024
29f3214
feat: let windows desktop build without secrets
coroiu Dec 6, 2024
c41e907
fix: has_secrets not being output correctly
coroiu Dec 6, 2024
74db413
feat: let macos desktop build without secrets
coroiu Dec 6, 2024
adc7edc
feat: don't build browser as part of desktop
coroiu Dec 6, 2024
495d528
feat: change CLI to pull_request
coroiu Dec 6, 2024
9ce8632
feat: let web build without secrets
coroiu Dec 9, 2024
fbadf16
feat: tweak lint to run on PR and not just push
coroiu Dec 10, 2024
a849fb5
feat: add PR target workflows
coroiu Dec 10, 2024
6d9f7f0
fix: remove wip files
coroiu Dec 10, 2024
fd82e2f
fix: lint on hotfix-rc branches
coroiu Dec 10, 2024
88cfa9b
Merge branch 'main' into PM-15126-tighten-scope-of-our-client-build-pโ€ฆ
coroiu Dec 11, 2024
76cd84f
feat: add new workflows to CODEOWNERS
coroiu Dec 11, 2024
87cd88c
Merge branch 'main' into PM-15126-tighten-scope-of-our-client-build-pโ€ฆ
coroiu Dec 12, 2024
53a7286
Merge branch 'main' into PM-15126-third-attempt
coroiu Feb 3, 2025
dd9a2be
fix: remove workflow_dispatch
coroiu Feb 10, 2025
6c439c2
Merge branch 'main' into PM-15126-third-attempt
coroiu Feb 10, 2025
cadd475
Merge branch 'main' into PM-15126-third-attempt
coroiu Feb 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,13 @@ apps/web/src/app/shared @bitwarden/team-platform-dev
apps/web/src/translation-constants.ts @bitwarden/team-platform-dev
# Workflows
.github/workflows/brew-bump-desktop.yml @bitwarden/team-platform-dev
.github/workflows/build-browser-target.yml @bitwarden/team-platform-dev
.github/workflows/build-browser.yml @bitwarden/team-platform-dev
.github/workflows/build-cli-target.yml @bitwarden/team-platform-dev
.github/workflows/build-cli.yml @bitwarden/team-platform-dev
.github/workflows/build-desktop-target.yml @bitwarden/team-platform-dev
.github/workflows/build-desktop.yml @bitwarden/team-platform-dev
.github/workflows/build-web-target.yml @bitwarden/team-platform-dev
.github/workflows/build-web.yml @bitwarden/team-platform-dev
.github/workflows/chromatic.yml @bitwarden/team-platform-dev
.github/workflows/lint.yml @bitwarden/team-platform-dev
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/build-browser-target.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Build Browser on PR Target

on:
pull_request:
types: [opened, synchronize]
branches-ignore:
- 'l10n_master'
- 'cf-pages'
paths:
- 'apps/browser/**'
- 'libs/**'
- '*'
- '!*.md'
- '!*.txt'
workflow_call:
inputs: {}
workflow_dispatch:
inputs:
sdk_branch:
description: "Custom SDK branch"
required: false
type: string

defaults:
run:
shell: bash

jobs:
check-run:
name: Check PR run
uses: bitwarden/gh-actions/.github/workflows/check-run.yml@main

run-workflow:
name: Run Build Browser on PR Target
needs: check-run
if: ${{ github.event.pull_request.head.repo.full_name != github.repository }}
uses: ./.github/workflows/build-browser.yml
secrets: inherit
justindbaur marked this conversation as resolved.
Show resolved Hide resolved

18 changes: 11 additions & 7 deletions .github/workflows/build-browser.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Build Browser

on:
pull_request_target:
pull_request:
types: [opened, synchronize]
branches-ignore:
- 'l10n_master'
Expand Down Expand Up @@ -38,19 +38,14 @@ defaults:
shell: bash

jobs:
check-run:
name: Check PR run
uses: bitwarden/gh-actions/.github/workflows/check-run.yml@main

setup:
name: Setup
runs-on: ubuntu-22.04
needs:
- check-run
outputs:
repo_url: ${{ steps.gen_vars.outputs.repo_url }}
adj_build_number: ${{ steps.gen_vars.outputs.adj_build_number }}
node_version: ${{ steps.retrieve-node-version.outputs.node_version }}
has_secrets: ${{ steps.check-secrets.outputs.has_secrets }}
steps:
- name: Check out repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
Expand All @@ -74,6 +69,14 @@ jobs:
NODE_VERSION=${NODE_NVMRC/v/''}
echo "node_version=$NODE_VERSION" >> $GITHUB_OUTPUT

- name: Check secrets
id: check-secrets
env:
AZURE_KV_CI_SERVICE_PRINCIPAL: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
run: |
has_secrets=${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL != '' }}
echo "has_secrets=$has_secrets" >> $GITHUB_OUTPUT


locales-test:
name: Locales Test
Expand Down Expand Up @@ -281,6 +284,7 @@ jobs:
needs:
- setup
- locales-test
if: ${{ needs.setup.outputs.has_secrets == 'true' }}
env:
_BUILD_NUMBER: ${{ needs.setup.outputs.adj_build_number }}
_NODE_VERSION: ${{ needs.setup.outputs.node_version }}
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/build-cli-target.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Build CLI on PR Target

on:
pull_request:
types: [opened, synchronize]
branches-ignore:
- 'l10n_master'
- 'cf-pages'
paths:
- 'apps/cli/**'
- 'libs/**'
- '*'
- '!*.md'
- '!*.txt'
- '.github/workflows/build-cli.yml'
- 'bitwarden_license/bit-cli/**'
workflow_dispatch:
inputs:
sdk_branch:
description: "Custom SDK branch"
required: false
type: string

defaults:
run:
shell: bash

jobs:
check-run:
name: Check PR run
uses: bitwarden/gh-actions/.github/workflows/check-run.yml@main

run-workflow:
name: Run Build CLI on PR Target
needs: check-run
if: ${{ github.event.pull_request.head.repo.full_name != github.repository }}
uses: ./.github/workflows/build-cli.yml
secrets: inherit

27 changes: 16 additions & 11 deletions .github/workflows/build-cli.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Build CLI

on:
pull_request_target:
pull_request:
types: [opened, synchronize]
branches-ignore:
- 'l10n_master'
Expand All @@ -27,6 +27,8 @@ on:
- '!*.txt'
- '.github/workflows/build-cli.yml'
- 'bitwarden_license/bit-cli/**'
workflow_call:
inputs: {}
workflow_dispatch:
inputs:
sdk_branch:
Expand All @@ -39,18 +41,13 @@ defaults:
working-directory: apps/cli

jobs:
check-run:
name: Check PR run
uses: bitwarden/gh-actions/.github/workflows/check-run.yml@main

setup:
name: Setup
runs-on: ubuntu-22.04
needs:
- check-run
outputs:
package_version: ${{ steps.retrieve-package-version.outputs.package_version }}
node_version: ${{ steps.retrieve-node-version.outputs.node_version }}
has_secrets: ${{ steps.check-secrets.outputs.has_secrets }}
steps:
- name: Check out repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
Expand All @@ -71,6 +68,14 @@ jobs:
NODE_VERSION=${NODE_NVMRC/v/''}
echo "node_version=$NODE_VERSION" >> $GITHUB_OUTPUT

- name: Check secrets
id: check-secrets
env:
AZURE_KV_CI_SERVICE_PRINCIPAL: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
run: |
has_secrets=${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL != '' }}
echo "has_secrets=$has_secrets" >> $GITHUB_OUTPUT

cli:
name: CLI ${{ matrix.os.base }} - ${{ matrix.license_type.readable }}
strategy:
Expand Down Expand Up @@ -117,7 +122,7 @@ jobs:
working-directory: ./

- name: Download SDK Artifacts
if: ${{ inputs.sdk_branch != '' }}
if: ${{ inputs.sdk_branch != '' && needs.setup.outputs.has_secrets == 'true' }}
uses: bitwarden/gh-actions/download-artifacts@main
with:
github_token: ${{secrets.GITHUB_TOKEN}}
Expand All @@ -130,7 +135,7 @@ jobs:
if_no_artifact_found: fail

- name: Override SDK
if: ${{ inputs.sdk_branch != '' }}
if: ${{ inputs.sdk_branch != '' && needs.setup.outputs.has_secrets == 'true' }}
working-directory: ./
run: |
ls -l ../
Expand Down Expand Up @@ -272,7 +277,7 @@ jobs:
working-directory: ./

- name: Download SDK Artifacts
if: ${{ inputs.sdk_branch != '' }}
if: ${{ inputs.sdk_branch != '' && needs.setup.outputs.has_secrets == 'true' }}
uses: bitwarden/gh-actions/download-artifacts@main
with:
github_token: ${{secrets.GITHUB_TOKEN}}
Expand All @@ -285,7 +290,7 @@ jobs:
if_no_artifact_found: fail

- name: Override SDK
if: ${{ inputs.sdk_branch != '' }}
if: ${{ inputs.sdk_branch != '' && needs.setup.outputs.has_secrets == 'true' }}
working-directory: ./
run: |
ls -l ../
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/build-desktop-target.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Build Desktop on PR Target

on:
pull_request:
types: [opened, synchronize]
branches-ignore:
- 'l10n_master'
- 'cf-pages'
paths:
- 'apps/desktop/**'
- 'libs/**'
- '*'
- '!*.md'
- '!*.txt'
- '.github/workflows/build-desktop.yml'
workflow_dispatch:
inputs:
sdk_branch:
description: "Custom SDK branch"
required: false
type: string

defaults:
run:
shell: bash

jobs:
check-run:
name: Check PR run
uses: bitwarden/gh-actions/.github/workflows/check-run.yml@main

run-workflow:
name: Run Build Desktop on PR Target
needs: check-run
if: ${{ github.event.pull_request.head.repo.full_name != github.repository }}
uses: ./.github/workflows/build-desktop.yml
secrets: inherit

Loading
Loading