Skip to content

Update Agent Pool reconciliation logic (#487) #623

Update Agent Pool reconciliation logic (#487)

Update Agent Pool reconciliation logic (#487) #623

name: E2E on HCP Terraform Operator [Helm]
on:
schedule:
- cron: '30 6 * * 0'
push:
branches:
- main
paths:
- 'controllers/**'
- 'charts/hcp-terraform-operator/**'
workflow_dispatch:
workflow_call:
env:
USE_EXISTING_CLUSTER: true
CLUSTER_NAME: 'this'
DOCKER_IMAGE: 'this'
KUBECONFIG: ${{ github.workspace }}/.kube/config
jobs:
tests:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version-file: 'go.mod'
- name: Set up kind
uses: helm/kind-action@0025e74a8c7512023d06dc019c617aa3cf561fde # v1.10.0
with:
wait: 2m
version: v${{ vars.KIND_VERSION }}
cluster_name: ${{ env.CLUSTER_NAME }}
- name: Set up Helm
uses: Azure/setup-helm@fe7b79cd5ee1e45176fcad797de68ecaf3ca4814 # v4.2.0
with:
version: v3.11.2
- name: Generate Docker image metadata
id: meta
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1
with:
images: ${{ env.DOCKER_IMAGE }}
tags: |
type=sha,prefix=,format=short
- name: Set up QEMU
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0
with:
platforms: amd64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0
- name: Build and load Docker image
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0
with:
platforms: linux/amd64
load: true
build-args:
BIN_NAME=${{ vars.BIN_NAME }}
tags: ${{ env.DOCKER_METADATA_OUTPUT_TAGS }}
- name: Upload Docker image to kind
run: |
kind load docker-image ${{ env.DOCKER_METADATA_OUTPUT_TAGS }} --name ${{ env.CLUSTER_NAME }}
- name: Install Helm chart
run: |
helm install --wait --timeout 1m this ./charts/hcp-terraform-operator \
--set operator.image.repository=${{ env.DOCKER_IMAGE }} \
--set operator.image.tag=${{ env.DOCKER_METADATA_OUTPUT_VERSION }} \
--set operator.syncPeriod=30s \
--set controllers.agentPool.workers=5 \
--set controllers.module.workers=5 \
--set controllers.project.workers=5 \
--set controllers.workspace.workers=5
- name: Run end-to-end test suite
run: make test
env:
TFC_OAUTH_TOKEN: ${{ secrets.TFC_OAUTH_TOKEN }}
TFC_ORG: ${{ secrets.TFC_ORG }}
TFC_TOKEN: ${{ secrets.TFC_TOKEN }}
TFC_VCS_REPO: ${{ secrets.TFC_VCS_REPO }}