Add more projects to the automation #291
Workflow file for this run
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: Apply new changes to SolEng repositories | |
on: | |
workflow_dispatch: | |
pull_request: | |
branches: | |
- main | |
paths: | |
- terraform-plans/** | |
- .github/workflows/terraform-apply.yaml | |
push: | |
branches: | |
- main | |
paths: | |
- terraform-plans/** | |
- .github/workflows/terraform-apply.yaml | |
jobs: | |
lint: | |
name: Linters | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout branch | |
uses: actions/checkout@v4 | |
- name: Install Terraform | |
run: sudo snap install terraform --classic | |
- name: Terraform format lint | |
working-directory: ./terraform-plans | |
run: terraform fmt -check -recursive -diff | |
terraform: | |
name: Run Terraform | |
needs: | |
- lint | |
runs-on: ubuntu-22.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
repository: | |
# The naming convention of the files is $REPO_$BRANCH.tfvars | |
- bootstack-actions_main | |
- charm-advanced-routing_main | |
- charm-apt-mirror_main | |
- charm-cloudsupport_main | |
- charm-duplicity_main | |
- charm-juju-backup-all_main | |
- charm-juju-local_main | |
- charm-local-users_main | |
- charm-logrotated_main | |
- charm-nginx_main | |
- charm-nrpe_main | |
- charm-openstack-service-checks_main | |
- charm-prometheus-blackbox-exporter_main | |
- charm-prometheus-juju-exporter_main | |
- charm-prometheus-libvirt-exporter_main | |
- charm-simple-streams_main | |
- charm-storage-connector_main | |
- charm-sysconfig_main | |
- charm-userdir-ldap_main | |
- charmed-openstack-exporter-snap_main | |
- charmed-openstack-upgrader_main | |
- hardware-observer-operator_main | |
- juju-backup-all_main | |
- juju-lint_main | |
- layer-beats-base_main | |
- layer-filebeat_main | |
- openstack-exporter-operator_main | |
- prometheus-hardware-exporter_main | |
- prometheus-juju-backup-all-exporter_main | |
- prometheus-juju-exporter_main | |
- prometheus-openstack-exporter_main | |
- smartctl-exporter-snap_main | |
- snap-tempest-automation_main | |
- snap-tempest_main | |
- snap-tempest_stable_antelope | |
- snap-tempest_stable_bobcat | |
- snap-tempest_stable_caracal | |
- snap-tempest_stable_ussuri | |
- snap-tempest_stable_victoria | |
- snap-tempest_stable_wallaby | |
- snap-tempest_stable_xena | |
- snap-tempest_stable_yoga | |
- snap-tempest_stable_zed | |
- solutions-engineering-automation_main | |
- tailscale-snap_main | |
- dcgm-snap_main | |
steps: | |
- name: Checkout branch | |
uses: actions/checkout@v4 | |
- name: Install Terraform | |
run: sudo snap install terraform --classic | |
- name: Terraform init | |
working-directory: ./terraform-plans | |
run: terraform init | |
- name: Terraform validate | |
working-directory: ./terraform-plans | |
env: | |
GITHUB_APP_ID: ${{ secrets.SOLENG_APP_ID }} | |
GITHUB_APP_INSTALLATION_ID: ${{ secrets.SOLENG_APP_INSTALLATION_ID }} | |
GITHUB_APP_PEM_FILE: ${{ secrets.SOLENG_APP_PEM_FILE }} | |
run: terraform validate -no-color | |
- name: Terraform plan | |
working-directory: ./terraform-plans | |
env: | |
GITHUB_APP_ID: ${{ secrets.SOLENG_APP_ID }} | |
GITHUB_APP_INSTALLATION_ID: ${{ secrets.SOLENG_APP_INSTALLATION_ID }} | |
GITHUB_APP_PEM_FILE: ${{ secrets.SOLENG_APP_PEM_FILE }} | |
run: | | |
terraform plan -no-color \ | |
-var-file=configs/github.tfvars \ | |
-var-file=configs/${{ matrix.repository }}.tfvars \ | |
-var="pr_branch_prefix=${{ github.head_ref }}" \ | |
-var="pr_body=This is an automated pull request from https://github.com/${{ github.repository }}/pull/${{ github.event.number }} to update centrally managed files." \ | |
-out ./tf.plan | |
- name: Terraform apply (if running on PR) | |
if: github.event.pull_request.draft == false | |
working-directory: ./terraform-plans | |
env: | |
GITHUB_APP_ID: ${{ secrets.SOLENG_APP_ID }} | |
GITHUB_APP_INSTALLATION_ID: ${{ secrets.SOLENG_APP_INSTALLATION_ID }} | |
GITHUB_APP_PEM_FILE: ${{ secrets.SOLENG_APP_PEM_FILE }} | |
run: | | |
terraform apply ./tf.plan -no-color |