Skip to content

Add parallel connections #1313

Add parallel connections

Add parallel connections #1313

Workflow file for this run

# Terraform Provider testing workflow.
name: Tests
# This GitHub action runs your tests for each pull request and push.
# Optionally, you can turn it on using a schedule for regular testing.
on:
pull_request:
paths-ignore:
- 'README.md'
push:
paths-ignore:
- 'README.md'
# Testing only needs permissions to read the repository contents.
permissions:
contents: read
jobs:
# Ensure project builds before running testing matrix
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version-file: 'go.mod'
cache: true
- run: go mod download
- run: go build -v .
- name: Run linters
uses: golangci/golangci-lint-action@aaa42aa0628b4ae2578232a66b541047968fac86 # v6.1.0
with:
version: latest
generate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version-file: 'go.mod'
cache: true
- run: go generate ./...
- name: git diff
run: |
git diff --compact-summary --exit-code || \
(echo; echo "Unexpected difference in directories after code generation. Run 'go generate ./...' command and commit."; exit 1)
goreleaser:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
with:
# Allow goreleaser to access older tag information.
fetch-depth: 0
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version-file: 'go.mod'
cache: true
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 # v6.0.0
with:
args: check
env:
# GitHub sets the GITHUB_TOKEN secret automatically.
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
# Run acceptance tests in a matrix with Terraform CLI versions
test-tofu:
name: Opentofu Provider Acceptance Tests
needs: build
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
# list whatever tofu versions here you would like to support
tofu:
- '1.7.*'
- '1.8.*'
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version-file: 'go.mod'
cache: true
- uses: opentofu/setup-opentofu@v1
with:
tofu_version: ${{ matrix.tofu }}
tofu_wrapper: false
- name: Setup kind
uses: helm/kind-action@0025e74a8c7512023d06dc019c617aa3cf561fde # v1.10.0
with:
wait: 0
config: .github/config/acceptance_tests_kind_config.yaml
- run: go mod download
- env:
TF_ACC: "1"
TF_ACC_PROVIDER_NAMESPACE: "hashicorp"
TF_ACC_PROVIDER_HOST: "registry.opentofu.org"
run: TF_ACC_TERRAFORM_PATH=$(which tofu) go test -v -cover ./cilium
timeout-minutes: 10
test:
name: Terraform Provider Acceptance Tests
needs: build
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
# list whatever Terraform versions here you would like to support
terraform:
- '1.5.*'
- '1.6.*'
- '1.7.*'
- '1.8.*'
- '1.10.0-alpha20240828'
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version-file: 'go.mod'
cache: true
- uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
with:
terraform_version: ${{ matrix.terraform }}
terraform_wrapper: false
- name: Setup kind
uses: helm/kind-action@0025e74a8c7512023d06dc019c617aa3cf561fde # v1.10.0
with:
wait: 0
config: .github/config/acceptance_tests_kind_config.yaml
- run: go mod download
- env:
TF_ACC: "1"
run: go test -v -cover ./cilium
timeout-minutes: 10
test-cluster-mesh:
name: "Functionnal test: Clustermesh"
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
# list whatever tofu versions here you would like to support
tofu:
- '1.8.*'
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version-file: 'go.mod'
cache: true
- uses: opentofu/setup-opentofu@v1
with:
tofu_version: ${{ matrix.tofu }}
tofu_wrapper: true
- name: Setup kind test1
uses: helm/kind-action@0025e74a8c7512023d06dc019c617aa3cf561fde # v1.10.0
with:
wait: 0
config: .github/config/acceptance_tests_kind_config.yaml
cluster_name: "test1"
- name: Setup kind test2
uses: helm/kind-action@0025e74a8c7512023d06dc019c617aa3cf561fde # v1.10.0
with:
wait: 0
config: .github/config/acceptance_tests_kind_config2.yaml
cluster_name: "test2"
- run: make
- run: cp .github/tf/versions.tf .github/tf/clustermesh
- run: tofu init
working-directory: .github/tf/clustermesh
- run: tofu apply -auto-approve
working-directory: .github/tf/clustermesh
- run: tofu destroy -auto-approve
working-directory: .github/tf/clustermesh
test-kubeproxy-free:
name: "Functionnal test: kubeproxy-free"
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
# list whatever tofu versions here you would like to support
tofu:
- '1.8.*'
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version-file: 'go.mod'
cache: true
- uses: opentofu/setup-opentofu@v1
with:
tofu_version: ${{ matrix.tofu }}
tofu_wrapper: true
- name: Setup kind test1
uses: helm/kind-action@0025e74a8c7512023d06dc019c617aa3cf561fde # v1.10.0
with:
wait: 0
config: .github/config/acceptance_tests_kind_config.yaml
cluster_name: "test1"
- run: make
- run: cp .github/tf/versions.tf .github/tf/kubeproxy-free
- run: tofu init
working-directory: .github/tf/kubeproxy-free
- run: tofu apply -auto-approve
working-directory: .github/tf/kubeproxy-free
- run: kubectl get ds/kube-proxy -n kube-system -o jsonpath='{.status.currentNumberScheduled}' | grep -q 0
- run: tofu destroy -auto-approve
working-directory: .github/tf/kubeproxy-free
test-cilium-install:
name: "Functionnal test: cilium-install"
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
# list whatever tofu versions here you would like to support
tofu:
- '1.8.*'
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version-file: 'go.mod'
cache: true
- uses: opentofu/setup-opentofu@v1
with:
tofu_version: ${{ matrix.tofu }}
tofu_wrapper: true
- name: Setup kind test1
uses: helm/kind-action@0025e74a8c7512023d06dc019c617aa3cf561fde # v1.10.0
with:
wait: 0
config: .github/config/acceptance_tests_kind_config.yaml
cluster_name: "test1"
- run: make
- run: cp .github/tf/versions.tf .github/tf/cilium/
- run: kubectl create namespace cilium
- run: tofu init
working-directory: .github/tf/cilium
- run: tofu apply -auto-approve
working-directory: .github/tf/cilium
- run: kubectl get pod -n cilium
- run: tofu destroy -auto-approve
working-directory: .github/tf/cilium
- run: kubectl get pod -n cilium
test-content-provider:
name: "Functionnal test: attribute config_content"
runs-on: ubuntu-latest
env:
dir: .github/tf/provider-config-content/
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
# list whatever tofu versions here you would like to support
tofu:
- '1.8.*'
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version-file: 'go.mod'
cache: true
- uses: opentofu/setup-opentofu@v1
with:
tofu_version: ${{ matrix.tofu }}
tofu_wrapper: true
- name: Setup kind test1
uses: helm/kind-action@0025e74a8c7512023d06dc019c617aa3cf561fde # v1.10.0
with:
wait: 0
config: .github/config/acceptance_tests_kind_config.yaml
cluster_name: "test1"
- run: make
- run: cp .github/tf/versions.tf $dir
- run: echo "config_content = \"$(cat ${HOME}/.kube/config | base64 -w 0)\"" > $dir/tofu.auto.tfvars
- run: cat $dir/tofu.auto.tfvars
- run: tofu init
working-directory: ${{ env.dir }}
- run: tofu plan
working-directory: ${{ env.dir }}
- run: ls 2>/dev/null -l /tmp/kubeconfig* | wc -l
- run: tofu apply -auto-approve
working-directory: ${{ env.dir }}
- run: ls 2>/dev/null -l /tmp/kubeconfig* | wc -l
- run: tofu destroy -auto-approve
working-directory: ${{ env.dir }}
- run: ls 2>/dev/null -l /tmp/kubeconfig* | wc -l