Skip to content

zip and tagging changes for workflows #8

zip and tagging changes for workflows

zip and tagging changes for workflows #8

Workflow file for this run

name: Infrastructure Change Test
on:
push:
pull_request:
branches:
- 'main'
paths:
- 'infrastructure/**'
jobs:
change-test:
runs-on: ubuntu-latest
name: Create and teardown cluster infrastructure
env:
OCI_CLI_USER: ${{ secrets.OCI_CLI_USER }}
OCI_CLI_TENANCY: ${{ secrets.OCI_CLI_TENANCY }}
OCI_CLI_FINGERPRINT: ${{ secrets.OCI_CLI_FINGERPRINT }}
OCI_CLI_KEY_CONTENT: ${{ secrets.OCI_CLI_KEY_CONTENT }}
OCI_CLI_REGION: ${{ secrets.OCI_CLI_REGION }}
OPENSHIFT_IMAGE_SOURCE_URI: ${{ secrets.OPENSHIFT_IMAGE_SOURCE_URI }}
COMPARTMENT_OCID: ${{ secrets.COMPARTMENT_OCID }}
ZONE_DNS_SUFFIX: ${{ secrets.ZONE_DNS_SUFFIX }}
CLUSTER_NAME: change-test
REUSE_TAGS: true
TAG_NAMESPACE: openshift-cicd
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set NOW env variable
run: echo "NOW=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_ENV
- name: Create Terraform ZIP
run: make zip
- name: Create RMS Stack
uses: oracle-actions/[email protected]
id: create-stack
with:
command: 'resource-manager stack create --compartment-id ${{ env.COMPARTMENT_OCID }} --display-name ${{ github.job }}-${{ env.NOW }} --config-source infrastructure.zip --variables "{\"reuse_tags\": \"${{ env.REUSE_TAGS }}\", \"tag_namespace_name\": \"${{ env.TAG_NAMESPACE }}\", \"compartment_ocid\": \"${{ env.COMPARTMENT_OCID }}\", \"cluster_name\": \"${{ env.CLUSTER_NAME }}-${{ env.NOW }}\", \"openshift_image_source_uri\": \"${{ env.OPENSHIFT_IMAGE_SOURCE_URI }}\", \"region\": \"${{ env.OCI_CLI_REGION }}\", \"tenancy_ocid\": \"${{ env.OCI_CLI_TENANCY }}\", \"zone_dns\": \"${{ env.CLUSTER_NAME }}--${{ env.NOW }}${{ env.ZONE_DNS_SUFFIX }}\"}"'
query: 'data.id'
silent: false
- name: RMS Stack Plan Job
uses: oracle-actions/[email protected]
id: stack-plan-job
with:
command: 'resource-manager job create-plan-job --wait-for-state SUCCEEDED --stack-id ${{ steps.create-stack.outputs.raw_output }}'
- name: RMS Stack Apply Job
uses: oracle-actions/[email protected]
id: stack-apply-job
with:
command: 'resource-manager job create-apply-job --wait-for-state SUCCEEDED --max-wait-seconds 2400 --execution-plan-strategy AUTO_APPROVED --stack-id ${{ steps.create-stack.outputs.raw_output }}'
- name: RMS Stack Destroy Job
uses: oracle-actions/[email protected]
id: stack-destroy-job
with:
command: 'resource-manager job create-destroy-job --wait-for-state SUCCEEDED --max-wait-seconds 2400 --execution-plan-strategy AUTO_APPROVED --stack-id ${{ steps.create-stack.outputs.raw_output }}'
- name: Destroy RMS Stack
uses: oracle-actions/[email protected]
id: destroy-stack
with:
command: 'resource-manager stack delete --force --stack-id ${{ steps.create-stack.outputs.raw_output }}'