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

Deploy CMMS to dev environment on release. #978

Merged
merged 1 commit into from
May 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
21 changes: 10 additions & 11 deletions .github/workflows/configure-duchy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,10 @@ on:
description: "Name (external ID) of Duchy"
type: string
required: true
duchy-cert-id:
description: "ID of the Duchy certificate"
type: string
required: true
apply:
description: "Apply the new configuration"
type: boolean
default: true
required: true
workflow_dispatch:
inputs:
environment:
Expand All @@ -55,10 +51,6 @@ on:
- worker2
- aggregator
required: true
duchy-cert-id:
description: "ID of the Duchy certificate"
type: string
required: true
apply:
description: "Apply the new configuration"
type: boolean
Expand All @@ -76,7 +68,7 @@ jobs:
runs-on: ubuntu-20.04
environment: ${{ inputs.environment }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

# Authenticate to Google Cloud. This will export some environment
# variables, including GCLOUD_PROJECT.
Expand All @@ -86,13 +78,19 @@ jobs:
workload_identity_provider: ${{ vars.WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ vars.GKE_CONFIG_SERVICE_ACCOUNT }}

- name: Export DUCHY_CERT_ID
env:
AGGREGATOR_DUCHY_CERT_ID: ${{ vars.AGGREGATOR_DUCHY_CERT_ID }}
WORKER1_DUCHY_CERT_ID: ${{ vars.WORKER1_DUCHY_CERT_ID }}
WORKER2_DUCHY_CERT_ID: ${{ vars.WORKER2_DUCHY_CERT_ID }}
run: ./.github/workflows/export-duchy-cert-id.sh

- name: Generate archives
env:
IMAGE_TAG: ${{ inputs.image-tag }}
SPANNER_INSTANCE: ${{ vars.SPANNER_INSTANCE }}
KINGDOM_SYSTEM_API_TARGET: ${{ vars.KINGDOM_SYSTEM_API_TARGET }}
DUCHY_STORAGE_BUCKET: ${{ vars.DUCHY_STORAGE_BUCKET }}
DUCHY_CERT_ID: ${{ inputs.duchy-cert-id }}
run: >
bazelisk build
"//src/main/k8s/dev:${DUCHY_NAME}_duchy.tar"
Expand All @@ -105,6 +103,7 @@ jobs:
--define "duchy_storage_bucket=$DUCHY_STORAGE_BUCKET"
--define "duchy_cert_id=$DUCHY_CERT_ID"


- name: Make Kustomization dir
run: mkdir -p "$KUSTOMIZATION_PATH"

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/configure-kingdom.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ on:
apply:
description: "Apply the new configuration"
type: boolean
default: true
required: true
workflow_dispatch:
inputs:
environment:
Expand Down Expand Up @@ -55,7 +55,7 @@ jobs:
runs-on: ubuntu-20.04
environment: ${{ inputs.environment }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

# Authenticate to Google Cloud. This will export some environment
# variables, including GCLOUD_PROJECT.
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright 2023 The Cross-Media Measurement Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: Deploy to dev environment

on:
release:
types: [published]

jobs:
update-cmms:
uses: ./.github/workflows/update-cmms.yml
with:
environment: dev
apply: true

# TODO(@SanjayVas): Update Reporting system.
34 changes: 34 additions & 0 deletions .github/workflows/export-duchy-cert-id.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env bash
# Copyright 2023 The Cross-Media Measurement Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


declare duchy_cert_id
case "$DUCHY_NAME" in
aggregator)
duchy_cert_id="$AGGREGATOR_DUCHY_CERT_ID"
;;
worker1)
duchy_cert_id="$WORKER1_DUCHY_CERT_ID"
;;
worker2)
duchy_cert_id="$WORKER2_DUCHY_CERT_ID"
;;
*)
echo "Unexpected Duchy name $DUCHY_NAME" >&2
exit 1
;;
esac

echo "DUCHY_CERT_ID=${duchy_cert_id}" >> "$GITHUB_ENV"
80 changes: 80 additions & 0 deletions .github/workflows/update-cmms.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Copyright 2023 The Cross-Media Measurement Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: Update CMMS

on:
workflow_call:
inputs:
environment:
type: string
required: true
apply:
description: "Apply the new configuration"
type: boolean
required: true
workflow_dispatch:
inputs:
environment:
required: true
type: choice
options:
- dev
apply:
description: "Apply the new configuration"
type: boolean
default: false

jobs:
publish-images:
uses: ./.github/workflows/create-cmm-images.yml

# TODO(@SanjayVas): Call Terraforming workflows.

update-kingdom:
uses: ./.github/workflows/configure-kingdom.yml
needs: publish-images
with:
image-tag: ${{ needs.publish-images.outputs.image-tag }}
environment: ${{ inputs.environment }}
apply: ${{ inputs.apply }}

update-aggregator-duchy:
uses: ./.github/workflows/configure-duchy.yml
needs: publish-images
with:
duchy-name: aggregator
image-tag: ${{ needs.publish-images.outputs.image-tag }}
environment: ${{ inputs.environment }}
apply: ${{ inputs.apply }}

update-worker1-duchy:
uses: ./.github/workflows/configure-duchy.yml
needs: publish-images
with:
duchy-name: worker1
image-tag: ${{ needs.publish-images.outputs.image-tag }}
environment: ${{ inputs.environment }}
apply: ${{ inputs.apply }}

update-worker2-duchy:
uses: ./.github/workflows/configure-duchy.yml
needs: publish-images
with:
duchy-name: worker2
image-tag: ${{ needs.publish-images.outputs.image-tag }}
environment: ${{ inputs.environment }}
apply: ${{ inputs.apply }}

# TODO(@SanjayVas): Run correctness test.