Vendor 3rd-party charts and use ACR images (#305) #346
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI/CD | |
on: | |
push: | |
branches: [main] | |
tags: ["*"] | |
env: | |
PCTASKS_COSMOSDB__URL: ${{ secrets.COSMOSDB_URL }} | |
PCTASKS_COSMOSDB__KEY: ${{ secrets.COSMOSDB_KEY }} | |
PCTASKS_COSMOSDB__TEST_CONTAINER_SUFFIX: ${{ github.run_id }} | |
permissions: | |
id-token: write | |
jobs: | |
build_and_publish: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.8" | |
- name: Install local dependencies | |
run: ./scripts/install | |
- name: Setup | |
run: ./scripts/setup --no-aux-servers | |
- name: Test | |
run: ./scripts/test | |
- name: Validate collections | |
run: ./scripts/validate-collections | |
# Integration Tests | |
- name: Install Kind | |
uses: helm/[email protected] | |
with: | |
install_only: true | |
- name: Install Helm | |
uses: azure/setup-helm@v3 | |
with: | |
version: v3.8.2 | |
if: ${{ github.base_ref == 'main' }} | |
- name: Setup cluster | |
run: ./scripts/cluster setup | |
- name: Run integration tests | |
run: ./scripts/citest-integration | |
# Publish images | |
- name: Get image tag | |
id: get_image_tag | |
run: case "${GITHUB_REF}" in | |
*tags*) | |
echo "::set-output name=tag::${GITHUB_REF/refs\/tags\//}" | |
;; | |
*) | |
echo "::set-output name=tag::latest" | |
;; | |
esac | |
- name: Log in with Azure | |
uses: azure/login@v1 | |
with: | |
client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
- name: Publish images (test) | |
run: ./scripts/publish --acr pccomponentstest --tag ${{steps.get_image_tag.outputs.tag}} | |
- name: Publish images | |
run: ./scripts/publish --acr pccomponents --tag ${{steps.get_image_tag.outputs.tag}} | |
- name: Clean up CosmosDB test containers | |
run: ./scripts/setup --rm-test-containers | |
if: always() | |
outputs: | |
image_tag: ${{ steps.get_image_tag.outputs.tag }} | |
deploy: | |
runs-on: ubuntu-latest | |
if: ${{ github.ref == 'refs/heads/main' }} | |
needs: | |
- build_and_publish | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Log in with Azure | |
uses: azure/login@v1 | |
with: | |
client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
- name: Deploy | |
run: ./scripts/cideploy | |
env: | |
IMAGE_TAG: ${{needs.build_and_publish.outputs.image_tag}} | |
ENVIRONMENT: staging | |
ARM_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} | |
ARM_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
ARM_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }} | |
ARM_USE_OIDC: true |