Skip to content
This repository has been archived by the owner on Aug 23, 2024. It is now read-only.

fix formatting of GHA env file in integration CI #102

fix formatting of GHA env file in integration CI

fix formatting of GHA env file in integration CI #102

Workflow file for this run

name: 'integration'
# This workflow intends to verify that the module provisions
# successfully for all software and infrastructure defined.
# https://learn.hashicorp.com/tutorials/terraform/automate-terraform
on:
workflow_dispatch:
push:
paths-ignore:
- 'LICENSE'
- '**.md'
jobs:
integrate:
name: Integration Tests
runs-on: ${{ matrix.os }}
timeout-minutes: 120
strategy:
matrix:
os: [ubuntu-latest]
tf: [1.0.7]
vsphere:
#- vmware_os: vmware_esxi_6_7
# vcenter_iso: VMware-VCSA-all-6.7.0-14367737.iso
- vmware_os: vmware_esxi_7_0
vcenter_iso: VMware-VCSA-all-7.0.0-16189094.iso
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
TF_IN_AUTOMATION: 1
TF_VERSION: ${{ matrix.tf }}
TF_VAR_control_plane_node_count: 0
TF_VAR_vcenter_iso_name: ${{ matrix.vsphere.vcenter_iso }}
TF_VAR_vmware_os: ${{ matrix.vsphere.vmware_os }}
TF_VAR_esxi_host_count: 2
TF_VAR_esxi_size: "c3.medium.x86"
TF_VAR_router_size: "c3.medium.x86"
TF_VAR_facility: "dc13"
TF_VAR_create_project : false
steps:
- name: Checkout from Github
uses: actions/checkout@v4
- name: Add SHORT_SHA env property with commit short sha
run: echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV
- name: Install Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ env.TF_VERSION }}
- name: Initialize Terraform, Modules, and Plugins
id: init
run: terraform init -input=false
- id: project
uses: equinix-labs/[email protected]
with:
userToken: ${{ secrets.METAL_AUTH_TOKEN }}
# Configure an SSH Agent with a key that can access the project
- name: SSH Agent
run: |
ssh-agent -a $SSH_AUTH_SOCK > /dev/null
ssh-add <(echo ${{ steps.project.outputs.projectSSHPrivateKeyBase64 }} | base64 -d)
- name: Terraform Vars - Cluster Name
run: echo "TF_VAR_vcenter_cluster_name=tfacc-${SHORT_SHA}" >> $GITHUB_ENV
- name: Terraform Vars - Project ID
run: |
echo "TF_VAR_project_id=${{ steps.project.outputs.projectID }}" >> $GITHUB_ENV
echo "METAL_AUTH_TOKEN=${{ steps.project.outputs.projectToken }}" >> $GITHUB_ENV # used by Equinix provider when auth_token not specified
echo "TF_VAR_auth_token=${{ steps.project.outputs.projectToken }}" >> $GITHUB_ENV
echo "TF_VAR_s3_url=${{ secrets.S3_URL }}" >> $GITHUB_ENV
echo "TF_VAR_object_store_bucket_name=${{ secrets.S3_BUCKET_NAME }}" >> $GITHUB_ENV
echo "TF_VAR_s3_access_key=${{ secrets.S3_ACCESS_KEY }}" >> $GITHUB_ENV
echo "TF_VAR_s3_secret_key=${{ secrets.S3_SECRET_KEY }}" >> $GITHUB_ENV
- name: Terraform Plan
id: plan
timeout-minutes: 120
run: terraform plan -out=tfplan -input=false
- name: Terraform Apply
id: apply
timeout-minutes: 120
continue-on-error: true
run: terraform apply -input=false tfplan
- name: Terraform Destroy
continue-on-error: true
id: destroy
if: ${{ always() }}
run: terraform destroy -input=false -auto-approve
- name: Project Delete
if: ${{ always() }}
uses: equinix-labs/[email protected]
with:
authToken: ${{ secrets.METAL_AUTH_TOKEN }}
projectID: ${{ steps.project.outputs.projectID }}