This repository has been archived by the owner on Aug 23, 2024. It is now read-only.
update GitHub actions to use equinix-labs #97
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: '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/metal-project-action@v0.14.1 | |
env: | |
METAL_AUTH_TOKEN: ${{ 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.metal-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 | |
- 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 | |
env: | |
METAL_AUTH_TOKEN: ${{ steps.project.outputs.projectToken }} # used by Equinix provider when auth_token not specified | |
TF_VAR_auth_token: ${{ steps.project.outputs.projectToken }} | |
TF_VAR_s3_url: ${{ secrets.S3_URL }} | |
TF_VAR_object_store_bucket_name: ${{ secrets.S3_BUCKET_NAME }} | |
TF_VAR_s3_access_key: ${{ secrets.S3_ACCESS_KEY }} | |
TF_VAR_s3_secret_key: ${{ secrets.S3_SECRET_KEY }} | |
- name: Terraform Destroy | |
continue-on-error: true | |
id: destroy | |
if: ${{ always() }} | |
run: terraform destroy -input=false -auto-approve | |
env: | |
TF_VAR_auth_token: ${{ steps.project.outputs.projectToken }} | |
METAL_AUTH_TOKEN: ${{ steps.project.outputs.projectToken }} | |
- name: Project Delete | |
if: ${{ always() }} | |
uses: equinix-labs/metal-sweeper-action@v0.6.1 | |
env: | |
METAL_PROJECT_ID: ${{ steps.project.outputs.projectID }} | |
METAL_AUTH_TOKEN: ${{ secrets.METAL_AUTH_TOKEN }} |