Skip to content

Commit

Permalink
use tofu for CI
Browse files Browse the repository at this point in the history
  • Loading branch information
sjpb committed Jan 17, 2025
1 parent 24fc0a2 commit 5a702d7
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/extra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ on:
branches:
- main
paths:
- 'environments/.stackhpc/terraform/cluster_image.auto.tfvars.json'
- 'environments/.stackhpc/tofu/cluster_image.auto.tfvars.json'
- 'ansible/roles/doca/**'
- 'ansible/roles/cuda/**'
- 'ansible/roles/lustre/**'
- '.github/workflows/extra.yml'
pull_request:
paths:
- 'environments/.stackhpc/terraform/cluster_image.auto.tfvars.json'
- 'environments/.stackhpc/tofu/cluster_image.auto.tfvars.json'
- 'ansible/roles/doca/**'
- 'ansible/roles/cuda/**'
- 'ansible/roles/lustre/**'
Expand All @@ -30,7 +30,7 @@ jobs:
matrix: # build RL8, RL9
build:
- image_name: openhpc-extra-RL8
source_image_name_key: RL8 # key into environments/.stackhpc/terraform/cluster_image.auto.tfvars.json
source_image_name_key: RL8 # key into environments/.stackhpc/tofu/cluster_image.auto.tfvars.json
inventory_groups: doca,cuda,lustre
volume_size: 30 # needed for cuda
- image_name: openhpc-extra-RL9
Expand All @@ -51,7 +51,7 @@ jobs:
run: |
{
echo 'FAT_IMAGES<<EOF'
cat environments/.stackhpc/terraform/cluster_image.auto.tfvars.json
cat environments/.stackhpc/tofu/cluster_image.auto.tfvars.json
echo EOF
} >> "$GITHUB_ENV"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/s3-image-sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ on:
branches:
- main
paths:
- 'environments/.stackhpc/terraform/cluster_image.auto.tfvars.json'
- 'environments/.stackhpc/tofu/cluster_image.auto.tfvars.json'
env:
S3_BUCKET: openhpc-images-prerelease
IMAGE_PATH: environments/.stackhpc/terraform/cluster_image.auto.tfvars.json
IMAGE_PATH: environments/.stackhpc/tofu/cluster_image.auto.tfvars.json

jobs:
s3_cleanup:
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/stackhpc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,17 @@ jobs:
with:
tofu_version: 1.6.2

- name: Initialise terraform
run: terraform init
working-directory: ${{ github.workspace }}/environments/.stackhpc/terraform
- name: Initialise tofu
run: tofu init
working-directory: ${{ github.workspace }}/environments/.stackhpc/tofu

- name: Write clouds.yaml
run: |
mkdir -p ~/.config/openstack/
echo "${{ secrets[format('{0}_CLOUDS_YAML', env.CI_CLOUD)] }}" > ~/.config/openstack/clouds.yaml
shell: bash

- name: Setup environment-specific inventory/terraform inputs
- name: Setup environment-specific inventory/tofu inputs
run: |
. venv/bin/activate
. environments/.stackhpc/activate
Expand All @@ -108,15 +108,15 @@ jobs:
run: |
. venv/bin/activate
. environments/.stackhpc/activate
cd $APPLIANCES_ENVIRONMENT_ROOT/terraform
terraform apply -auto-approve -var-file="${{ env.CI_CLOUD }}.tfvars"
cd $APPLIANCES_ENVIRONMENT_ROOT/tofu
tofu apply -auto-approve -var-file="${{ env.CI_CLOUD }}.tfvars"
- name: Delete infrastructure if provisioning failed
run: |
. venv/bin/activate
. environments/.stackhpc/activate
cd $APPLIANCES_ENVIRONMENT_ROOT/terraform
terraform destroy -auto-approve -var-file="${{ env.CI_CLOUD }}.tfvars"
cd $APPLIANCES_ENVIRONMENT_ROOT/tofu
tofu destroy -auto-approve -var-file="${{ env.CI_CLOUD }}.tfvars"
if: failure() && steps.provision_servers.outcome == 'failure'

- name: Configure cluster
Expand Down Expand Up @@ -201,8 +201,8 @@ jobs:
run: |
. venv/bin/activate
. environments/.stackhpc/activate
cd $APPLIANCES_ENVIRONMENT_ROOT/terraform
terraform destroy -auto-approve -var-file="${{ env.CI_CLOUD }}.tfvars"
cd $APPLIANCES_ENVIRONMENT_ROOT/tofu
tofu destroy -auto-approve -var-file="${{ env.CI_CLOUD }}.tfvars"
if: ${{ success() || cancelled() }}

# - name: Delete images
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/trivyscan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches:
- main
paths:
- 'environments/.stackhpc/terraform/cluster_image.auto.tfvars.json'
- 'environments/.stackhpc/tofu/cluster_image.auto.tfvars.json'

jobs:
scan:
Expand All @@ -18,7 +18,7 @@ jobs:
matrix:
build: ["RL8", "RL9"]
env:
JSON_PATH: environments/.stackhpc/terraform/cluster_image.auto.tfvars.json
JSON_PATH: environments/.stackhpc/tofu/cluster_image.auto.tfvars.json
OS_CLOUD: openstack
CI_CLOUD: ${{ vars.CI_CLOUD }}

Expand Down

0 comments on commit 5a702d7

Please sign in to comment.