Skip to content

Commit

Permalink
modularize cidcd
Browse files Browse the repository at this point in the history
Signed-off-by: Gerd Oberlechner <[email protected]>
  • Loading branch information
geoberle committed Oct 30, 2024
1 parent bec6f41 commit 674266f
Show file tree
Hide file tree
Showing 4 changed files with 406 additions and 339 deletions.
354 changes: 15 additions & 339 deletions .github/workflows/aro-hcp-dev-env-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,357 +100,33 @@
cd dev-infrastructure/
make imagesync
deploy_region_rg:
#if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch'
permissions:
id-token: 'write'
contents: 'read'
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 1

- name: 'Az CLI login'
uses: azure/login@6c251865b4e6290e7b78be643ea2d005bc51f69a # v2.1.1
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

- name: "install azure-cli"
uses: "Azure/ARO-HCP@main"

- name: 'Deploy'
run: |
cd dev-infrastructure/
make region metrics-infra
deploy_service_cluster_rg:
#if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch'
needs:
- deploy_region_rg
permissions:
id-token: 'write'
contents: 'read'
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 1

- name: 'Az CLI login'
uses: azure/login@6c251865b4e6290e7b78be643ea2d005bc51f69a # v2.1.1
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

- name: "install azure-cli"
uses: "Azure/ARO-HCP@main"

- name: 'Deploy'
run: |
cd dev-infrastructure/
PRINCIPAL_ID=${{ secrets.GHA_PRINCIPAL_ID }} make svc svc.aks.admin-access svc.enable-aks-metrics
# grant GH action user access to resources
# PRINCIPAL_ID=${{ secrets.GHA_PRINCIPAL_ID }} make svc.dev-role-assignments
deploy_management_cluster_rg:
#if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch'
needs:
- deploy_region_rg
permissions:
id-token: 'write'
contents: 'read'
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 1

- name: 'Az CLI login'
uses: azure/login@6c251865b4e6290e7b78be643ea2d005bc51f69a # v2.1.1
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

- name: "install azure-cli"
uses: "Azure/ARO-HCP@main"

- name: 'Deploy or Update'
run: |
cd dev-infrastructure/
PRINCIPAL_ID=${{ secrets.GHA_PRINCIPAL_ID }} make mgmt mgmt.aks.admin-access mgmt.enable-aks-metrics
build_push_frontend:
needs:
- deploy_global_rg
permissions:
id-token: 'write'
contents: 'read'
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 1

- name: "install azure-cli"
uses: "Azure/ARO-HCP@main"

- name: Build frontend container image
run: |
cd frontend/
make image
- name: 'Az CLI login'
#if: github.event.pull_request.merged == true
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

- name: Push frontend container image
if: github.event.pull_request.merged == true
run: |
cd frontend/
make push
build_push_backend:
needs:
- deploy_global_rg
permissions:
id-token: 'write'
contents: 'read'
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 1

- name: "install azure-cli"
uses: "Azure/ARO-HCP@main"

- name: Build backend container image
run: |
cd backend/
make image
- name: 'Az CLI login'
#if: github.event.pull_request.merged == true
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

- name: Push backend container image
#if: github.event.pull_request.merged == true
run: |
cd backend/
make push
build_push_ocmirror:
permissions:
id-token: 'write'
contents: 'read'
deploy_environment_infra:
needs:
- deploy_global_rg
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 1

- name: "install azure-cli"
uses: "Azure/ARO-HCP@main"

- name: Build oc-mirror container image
run: |
cd image-sync/oc-mirror
make image
- name: 'Az CLI login'
#if: github.event.pull_request.merged == true
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

- name: Push oc-mirror container image
#if: github.event.pull_request.merged == true
run: |
cd image-sync/oc-mirror
make push
build_push_imagesync:
permissions:
id-token: 'write'
contents: 'read'
needs:
- deploy_global_rg
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 1

- name: "install azure-cli"
uses: "Azure/ARO-HCP@main"

- name: Build image-sync container image
run: |
cd tooling/image-sync
make image
- name: 'Az CLI login'
#if: github.event.pull_request.merged == true
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

- name: Push image-sync container image
#if: github.event.pull_request.merged == true
run: |
cd tooling/image-sync
make push
uses: ./.github/workflows/environment-infra-cd.yml
with:
deploy_env: dev

deploy_to_service_cluster:
#if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch'
needs:
- build_push_frontend
- build_push_backend
- build_push_imagesync
- build_push_ocmirror
- deploy_service_cluster_rg
service_ci:
permissions:
id-token: 'write'
contents: 'read'
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 1

- name: 'Az CLI login'
uses: azure/login@6c251865b4e6290e7b78be643ea2d005bc51f69a # v2.1.1
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

- name: "install azure-cli"
uses: "Azure/ARO-HCP@main"

- uses: azure/setup-kubectl@3e0aec4d80787158d308d7b364cb1b702e7feb7f # v4.0.0

# Used to deploy Cluster Service
- name: 'Install oc'
run: |
curl -sfLo - https://mirror.openshift.com/pub/openshift-v4/clients/ocp/4.15.9/openshift-client-linux.tar.gz | tar xzf -
sudo mv oc /usr/local/bin/oc
chmod +x /usr/local/bin/oc
# Used to deploy Maestro Server, Frontend
- uses: azure/setup-helm@fe7b79cd5ee1e45176fcad797de68ecaf3ca4814 # v4.2.0
with:
version: 'v3.13.3'

- uses: azure/use-kubelogin@76597ae0fcbaace21b05e13a2cbf8daee2c6e820 # v1.2
with:
kubelogin-version: 'v0.1.3'

# Prepare kubeconfig
- name: 'Prepare kubeconfig'
run: |
cd dev-infrastructure/
make svc.aks.kubeconfig
- name: 'Deploy Istio Configuration'
run: |
make isto.deploy
- name: 'Deploy Frontend'
run: |
make rp.frontend.deploy
- name: 'Deploy Backend'
run: |
make rp.backend.deploy
- name: 'Deploy Cluster Service'
run: |
make cs.deploy
- name: 'Deploy Maestro'
run: |
make maestro.server.deploy maestro.registration.deploy
- name: 'Deploy Image Sync'
run: |
make imagesync.deploy
- name: 'Deploy Prometheus Config'
run: |
make metrics.deploy
uses: ./.github/workflows/services-ci.yml
with:
push: true
#push: ${{ github.event.pull_request.merged == true }}

deploy_to_management_cluster:
deploy_services:
# if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch'
needs:
- deploy_management_cluster_rg
- service_ci
- deploy_environment_infra
permissions:
id-token: 'write'
contents: 'read'
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 1

- name: 'Az CLI login'
uses: azure/login@6c251865b4e6290e7b78be643ea2d005bc51f69a # v2.1.1
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

- name: "install azure-cli"
uses: "Azure/ARO-HCP@main"

- uses: azure/setup-kubectl@3e0aec4d80787158d308d7b364cb1b702e7feb7f # v4.0.0

- uses: azure/use-kubelogin@76597ae0fcbaace21b05e13a2cbf8daee2c6e820 # v1.2
with:
kubelogin-version: 'v0.1.3'

- uses: azure/setup-helm@fe7b79cd5ee1e45176fcad797de68ecaf3ca4814 # v4.2.0
with:
version: 'v3.13.3'

# Prepare kubeconfig
- name: 'Prepare kubeconfig'
run: |
cd dev-infrastructure/
make mgmt.aks.kubeconfig
- name: 'Deploy PKO'
run: |
make pko.deploy
- name: 'Deploy ACM'
run: |
make acm.deploy
- name: 'Deploy Maestro Agent'
run: |
make maestro.agent.deploy
- name: 'Deploy Hypershift Operator and External DNS Operator'
run: |
make hypershift.deploy
uses: ./.github/workflows/services-cd.yml
with:
deploy_env: dev
Loading

0 comments on commit 674266f

Please sign in to comment.