mirror of
https://github.com/bitwarden/server
synced 2025-12-26 13:13:24 +00:00
New BTR pipeline model (#1599)
Splitting out the build artifacts and the docker containers. Making the QA deploy more streamlined with the new build pipeline. Disabling the prod workflow, but keeping it until we fully migrate our deploy processes over to the new flow.
This commit is contained in:
124
.github/workflows/qa-deploy.yml
vendored
124
.github/workflows/qa-deploy.yml
vendored
@@ -12,109 +12,10 @@ on:
|
||||
default: "false"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- name: Api
|
||||
base_path: .
|
||||
- name: Admin
|
||||
base_path: .
|
||||
gulp: true
|
||||
- name: Billing
|
||||
base_path: .
|
||||
- name: Events
|
||||
base_path: .
|
||||
- name: Notifications
|
||||
base_path: .
|
||||
- name: Sso
|
||||
base_path: ./bitwarden_license
|
||||
gulp: true
|
||||
- name: Portal
|
||||
base_path: ./bitwarden_license
|
||||
gulp: true
|
||||
- name: Identity
|
||||
base_path: .
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
|
||||
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea
|
||||
with:
|
||||
node-version: '14'
|
||||
|
||||
- name: Update NPM
|
||||
run: |
|
||||
npm install -g npm@7
|
||||
|
||||
- name: Print Environment
|
||||
run: |
|
||||
dotnet --info
|
||||
node --version
|
||||
npm --version
|
||||
gulp --version
|
||||
|
||||
- name: Load env vars
|
||||
run: |
|
||||
echo "Base Path: ${BASE_PATH}"
|
||||
echo "Name: ${NAME}"
|
||||
env:
|
||||
BASE_PATH: ${{ matrix.base_path }}
|
||||
NAME: ${{ matrix.name }}
|
||||
|
||||
- name: Build Service
|
||||
run: |
|
||||
work_dir=$(pwd)
|
||||
dir=$BASE_PATH/src/$SERVICE_NAME
|
||||
|
||||
cd $dir
|
||||
echo "Restore"
|
||||
dotnet restore $SERVICE_NAME.csproj
|
||||
echo "Clean"
|
||||
dotnet clean $SERVICE_NAME.csproj -c "Release" -o obj/build-output/publish
|
||||
|
||||
if [ "$GULP" == "true" ]; then
|
||||
npm install
|
||||
npm install gulp
|
||||
gulp --gulpfile gulpfile.js build
|
||||
fi
|
||||
|
||||
echo "Publish"
|
||||
dotnet publish $SERVICE_NAME.csproj -c "Release" -o obj/build-output/publish
|
||||
|
||||
cd obj/build-output/publish
|
||||
zip -r $SERVICE_NAME.zip .
|
||||
mv $SERVICE_NAME.zip ../../../
|
||||
env:
|
||||
SERVICE_NAME: ${{ matrix.name }}
|
||||
BASE_PATH: ${{ matrix.base_path }}
|
||||
GULP: ${{ matrix.gulp }}
|
||||
|
||||
- name: Upload build artifact
|
||||
uses: actions/upload-artifact@ee69f02b3dfdecd58bb31b4d133da38ba6fe3700
|
||||
with:
|
||||
name: ${{ env.SERVICE_NAME }}.zip
|
||||
path: ${{ env.BASE_PATH }}/src/${{ env.SERVICE_NAME }}/${{ env.SERVICE_NAME }}.zip
|
||||
env:
|
||||
BASE_PATH: ${{ matrix.base_path }}
|
||||
SERVICE_NAME: ${{ matrix.name }}
|
||||
|
||||
- name: Test build dir
|
||||
run: ls $BASE_PATH/src/$SERVICE_NAME
|
||||
env:
|
||||
SERVICE_NAME: ${{ matrix.name }}
|
||||
BASE_PATH: ${{ matrix.base_path }}
|
||||
|
||||
|
||||
reset-db:
|
||||
name: Reset Database
|
||||
if: ${{ github.event.inputs.resetDb == 'true' }}
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Reset Test Data - Stub
|
||||
run: |
|
||||
@@ -125,8 +26,7 @@ jobs:
|
||||
update-db:
|
||||
name: Update Database
|
||||
if: ${{ github.event.inputs.migrateDb == 'true' }}
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
|
||||
@@ -161,7 +61,7 @@ jobs:
|
||||
|
||||
deploy:
|
||||
name: Deploy
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-20.04
|
||||
if: always()
|
||||
needs:
|
||||
- reset-db
|
||||
@@ -186,9 +86,15 @@ jobs:
|
||||
echo "NAME_LOWER: $NAME_LOWER"
|
||||
echo "::set-output name=name_lower::$NAME_LOWER"
|
||||
|
||||
- name: Download aritifacts
|
||||
uses: actions/download-artifact@158ca71f7c614ae705e79f25522ef4658df18253
|
||||
BRANCH_NAME=$(echo "{{ github.ref }}" | awk '{split($0, a, "/"); print a[3]}')
|
||||
echo "::set-output name=branch_name::$BRANCH_NAME"
|
||||
|
||||
- name: Download latest ${{ matrix.name }} asset from ${{ env.branch_name }}
|
||||
uses: bitwarden/gh-actions/download-artifacts@23433be15ed6fd046ce12b6889c5184a8d9c8783
|
||||
with:
|
||||
workflow: build.yml
|
||||
workflow_conclusion: success
|
||||
branch: ${{ env.branch_name }}
|
||||
name: ${{ matrix.name }}.zip
|
||||
|
||||
- name: Login to Azure
|
||||
@@ -201,12 +107,15 @@ jobs:
|
||||
env:
|
||||
VAULT_NAME: "bitwarden-qa-kv"
|
||||
run: |
|
||||
webapp_name=$(az keyvault secret show --vault-name $VAULT_NAME --name appservices-${{ steps.setup.outputs.name_lower }}-webapp-name --query value --output tsv)
|
||||
webapp_name=$(
|
||||
az keyvault secret show --vault-name $VAULT_NAME \
|
||||
--name appservices-${{ steps.setup.outputs.name_lower }}-webapp-name \
|
||||
--query value --output tsv
|
||||
)
|
||||
echo "::add-mask::$webapp_name"
|
||||
echo "::set-output name=webapp-name::$webapp_name"
|
||||
|
||||
- name: Stop App Service
|
||||
if: false
|
||||
env:
|
||||
AZURE_RESOURCE_GROUP: "bw-qa-env"
|
||||
run: az webapp stop --name ${{ steps.retrieve-secrets.outputs.webapp-name }} --resource-group $AZURE_RESOURCE_GROUP
|
||||
@@ -218,7 +127,6 @@ jobs:
|
||||
package: ./${{ matrix.name }}.zip
|
||||
|
||||
- name: Start App Service
|
||||
if: false
|
||||
env:
|
||||
AZURE_RESOURCE_GROUP: "bw-qa-env"
|
||||
run: az webapp start --name ${{ steps.retrieve-secrets.outputs.webapp-name }} --resource-group $AZURE_RESOURCE_GROUP
|
||||
|
||||
Reference in New Issue
Block a user