Setting embedded_manifest to true and repo visibility to private. #726
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: tests | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
env: | |
TERRAFORM_VERSION: 1.7.5 | |
jobs: | |
# Ensure project builds before running testing matrix | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 | |
with: | |
go-version-file: 'go.mod' | |
cache: true | |
- run: make build | |
generate: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 | |
with: | |
go-version-file: 'go.mod' | |
cache: true | |
# Temporarily download Terraform 1.8 prerelease for function documentation support. | |
# When Terraform 1.8.0 final is released, this can be removed. | |
- uses: hashicorp/setup-terraform@a1502cd9e758c50496cc9ac5308c4843bcd56d36 # v3.0.0 | |
with: | |
terraform_version: '1.8.0-alpha20240216' | |
terraform_wrapper: false | |
- 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) | |
docs: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Setup Go | |
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 | |
with: | |
go-version-file: 'go.mod' | |
cache: true | |
cache-dependency-path: | | |
**/go.sum | |
**/go.mod | |
- name: Install tools | |
run: make tools | |
- name: Generate docs | |
run: make docs | |
- name: Check if working tree is dirty | |
run: | | |
if [[ $(git diff --stat) != '' ]]; then | |
git diff | |
echo 'run make docs and commit changes' | |
exit 1 | |
fi | |
# Run acceptance tests in a matrix with Terraform CLI versions | |
test: | |
name: Terraform Provider Acceptance Tests | |
needs: build | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
strategy: | |
fail-fast: false | |
matrix: | |
terraform: | |
- '1.5.*' | |
- '1.6.*' | |
- '1.7.*' | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 | |
with: | |
go-version-file: 'go.mod' | |
cache: true | |
- uses: hashicorp/setup-terraform@a1502cd9e758c50496cc9ac5308c4843bcd56d36 # v3.0.0 | |
with: | |
terraform_version: ${{ matrix.terraform }} | |
terraform_wrapper: false | |
- name: Run tests | |
run: make testacc | |
e2e-flux-bootstrap-with-github: | |
runs-on: ubuntu-latest | |
needs: build | |
if: (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && github.actor != 'dependabot[bot]' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Setup Go | |
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 | |
with: | |
go-version-file: 'go.mod' | |
cache: true | |
cache-dependency-path: | | |
**/go.sum | |
**/go.mod | |
- name: Setup Flux CLI | |
uses: fluxcd/flux2/action@534684601ec8888beb0cc4f51117b59e97606c4d # v2.2.3 | |
- name: Set outputs | |
id: vars | |
run: | | |
REPOSITORY_NAME=${{ github.event.repository.name }} | |
BRANCH_NAME=${GITHUB_REF##*/} | |
COMMIT_SHA=$(git rev-parse HEAD) | |
PSEUDO_RAND_SUFFIX=$(echo "${BRANCH_NAME}-${COMMIT_SHA}" | shasum | awk '{print $1}') | |
TEST_REPO_NAME="${REPOSITORY_NAME}-${PSEUDO_RAND_SUFFIX}" | |
echo "test_repo_name=$TEST_REPO_NAME" >> $GITHUB_OUTPUT | |
- name: Install Terraform | |
uses: hashicorp/setup-terraform@a1502cd9e758c50496cc9ac5308c4843bcd56d36 # v3.0.0 | |
with: | |
terraform_version: "${{env.TERRAFORM_VERSION}}" | |
terraform_wrapper: false | |
- name: Build provider | |
run: | | |
make build | |
make terraformrc | |
- name: Apply Terraform | |
run: | | |
export TF_CLI_CONFIG_FILE="${PWD}/.terraformrc" | |
cd examples/github-via-ssh | |
terraform init | |
terraform apply -auto-approve -var "github_token=${GITHUB_TOKEN}" -var "github_org=fluxcd-testing" -var "github_repository=${{ steps.vars.outputs.test_repo_name }}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITPROVIDER_BOT_TOKEN }} | |
- name: Health check Flux | |
run: | | |
flux check | |
flux get all | |
- name: No-op apply Terraform | |
run: | | |
export TF_CLI_CONFIG_FILE="${PWD}/.terraformrc" | |
cd examples/github-via-ssh | |
terraform apply -auto-approve -var "github_token=${GITHUB_TOKEN}" -var "github_org=fluxcd-testing" -var "github_repository=${{ steps.vars.outputs.test_repo_name }}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITPROVIDER_BOT_TOKEN }} | |
- name: Teardown Flux | |
run: | | |
flux uninstall -s --keep-namespace | |
kubectl delete ns flux-system | |
- name: Restore Flux with Terraform | |
run: | | |
export TF_CLI_CONFIG_FILE="${PWD}/.terraformrc" | |
cd examples/github-via-ssh | |
terraform apply -auto-approve -var "github_token=${GITHUB_TOKEN}" -var "github_org=fluxcd-testing" -var "github_repository=${{ steps.vars.outputs.test_repo_name }}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITPROVIDER_BOT_TOKEN }} | |
- name: No-op apply Terraform | |
run: | | |
export TF_CLI_CONFIG_FILE="${PWD}/.terraformrc" | |
cd examples/github-via-ssh | |
terraform apply -auto-approve -var "github_token=${GITHUB_TOKEN}" -var "github_org=fluxcd-testing" -var "github_repository=${{ steps.vars.outputs.test_repo_name }}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITPROVIDER_BOT_TOKEN }} | |
- name: Destroy Terraform | |
run: | | |
cd examples/github-via-ssh | |
terraform destroy -auto-approve -var "github_token=${GITHUB_TOKEN}" -var "github_org=fluxcd-testing" -var "github_repository=${{ steps.vars.outputs.test_repo_name }}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITPROVIDER_BOT_TOKEN }} | |
- name: Delete repository | |
if: ${{ always() }} | |
continue-on-error: true | |
run: | | |
curl \ | |
-X DELETE \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
-H "Authorization: token ${GITHUB_TOKEN}" \ | |
--fail --silent \ | |
https://api.github.com/repos/fluxcd-testing/${{ steps.vars.outputs.test_repo_name }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITPROVIDER_BOT_TOKEN }} | |
e2e-helm-install-with-github: | |
runs-on: ubuntu-latest | |
needs: build | |
if: (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && github.actor != 'dependabot[bot]' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Setup Go | |
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 | |
with: | |
go-version-file: 'go.mod' | |
cache: true | |
cache-dependency-path: | | |
**/go.sum | |
**/go.mod | |
- name: Setup Flux CLI | |
uses: fluxcd/flux2/action@534684601ec8888beb0cc4f51117b59e97606c4d # v2.2.3 | |
- name: Set outputs | |
id: vars | |
run: | | |
REPOSITORY_NAME=${{ github.event.repository.name }} | |
BRANCH_NAME=${GITHUB_REF##*/} | |
COMMIT_SHA=$(git rev-parse HEAD) | |
PSEUDO_RAND_SUFFIX=$(echo "${BRANCH_NAME}-${COMMIT_SHA}" | shasum | awk '{print $1}') | |
TEST_REPO_NAME="${REPOSITORY_NAME}-${PSEUDO_RAND_SUFFIX}-helm-install" | |
echo "test_repo_name=$TEST_REPO_NAME" >> $GITHUB_OUTPUT | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITPROVIDER_BOT_TOKEN }} | |
- name: Install Terraform | |
uses: hashicorp/setup-terraform@a1502cd9e758c50496cc9ac5308c4843bcd56d36 # v3.0.0 | |
with: | |
terraform_version: "${{env.TERRAFORM_VERSION}}" | |
terraform_wrapper: false | |
- name: Build provider | |
run: | | |
make build | |
make terraformrc | |
- name: Apply Terraform | |
run: | | |
export TF_CLI_CONFIG_FILE="${PWD}/.terraformrc" | |
cd examples/helm-install | |
terraform init | |
terraform apply -auto-approve -var "github_token=${GITHUB_TOKEN}" -var "github_org=fluxcd-testing" -var "github_repository=${{ steps.vars.outputs.test_repo_name }}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITPROVIDER_BOT_TOKEN }} | |
- name: Health check Flux | |
run: flux check | |
- name: Destroy Terraform | |
run: | | |
cd examples/helm-install | |
terraform destroy -auto-approve -var "github_token=${GITHUB_TOKEN}" -var "github_org=fluxcd-testing" -var "github_repository=${{ steps.vars.outputs.test_repo_name }}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITPROVIDER_BOT_TOKEN }} | |
- name: Delete repository | |
if: ${{ always() }} | |
continue-on-error: true | |
run: | | |
curl \ | |
-X DELETE \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
-H "Authorization: token ${GITHUB_TOKEN}" \ | |
--fail --silent \ | |
https://api.github.com/repos/fluxcd-testing/${{ steps.vars.outputs.test_repo_name }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITPROVIDER_BOT_TOKEN }} | |
e2e-flux-bootstrap-with-github-pat: | |
runs-on: ubuntu-latest | |
needs: build | |
if: (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && github.actor != 'dependabot[bot]' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Setup Go | |
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 | |
with: | |
go-version-file: 'go.mod' | |
cache: true | |
cache-dependency-path: | | |
**/go.sum | |
**/go.mod | |
- name: Setup Flux CLI | |
uses: fluxcd/flux2/action@534684601ec8888beb0cc4f51117b59e97606c4d # v2.2.3 | |
- name: Set outputs | |
id: vars | |
run: | | |
REPOSITORY_NAME=${{ github.event.repository.name }} | |
BRANCH_NAME=${GITHUB_REF##*/} | |
COMMIT_SHA=$(git rev-parse HEAD) | |
PSEUDO_RAND_SUFFIX=$(echo "${BRANCH_NAME}-${COMMIT_SHA}" | shasum | awk '{print $1}') | |
TEST_REPO_NAME="${REPOSITORY_NAME}-${PSEUDO_RAND_SUFFIX}-using-pat" | |
echo "test_repo_name=$TEST_REPO_NAME" >> $GITHUB_OUTPUT | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITPROVIDER_BOT_TOKEN }} | |
- name: Install Terraform | |
uses: hashicorp/setup-terraform@a1502cd9e758c50496cc9ac5308c4843bcd56d36 # v3.0.0 | |
with: | |
terraform_version: "${{env.TERRAFORM_VERSION}}" | |
terraform_wrapper: false | |
- name: Build provider | |
run: | | |
make build | |
make terraformrc | |
- name: Apply Terraform | |
run: | | |
export TF_CLI_CONFIG_FILE="${PWD}/.terraformrc" | |
cd examples/github-via-pat | |
terraform init | |
terraform apply -auto-approve -var "github_token=${GITHUB_TOKEN}" -var "github_org=fluxcd-testing" -var "github_repository=${{ steps.vars.outputs.test_repo_name }}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITPROVIDER_BOT_TOKEN }} | |
- name: Health check Flux | |
run: flux check | |
- name: Destroy Terraform | |
run: | | |
cd examples/github-via-pat | |
terraform destroy -auto-approve -var "github_token=${GITHUB_TOKEN}" -var "github_org=fluxcd-testing" -var "github_repository=${{ steps.vars.outputs.test_repo_name }}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITPROVIDER_BOT_TOKEN }} | |
- name: Delete repository | |
if: ${{ always() }} | |
continue-on-error: true | |
run: | | |
curl \ | |
-X DELETE \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
-H "Authorization: token ${GITHUB_TOKEN}" \ | |
--fail --silent \ | |
https://api.github.com/repos/fluxcd-testing/${{ steps.vars.outputs.test_repo_name }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITPROVIDER_BOT_TOKEN }} |