Skip to content

Add channels var to snap_release workflow (#130) #360

Add channels var to snap_release workflow (#130)

Add channels var to snap_release workflow (#130) #360

name: Run terraform
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
# To format the repository to pass this lint:
# $ cd terraform-plans && terraform fmt -recursive
- 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
- headscale-snap_main
- derper-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 \
-out ./tf.plan
- name: Terraform apply (if running from main branch)
if: ${{ github.ref_name == 'main' }}
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