From 5cdefe8334e69bfabaac7c70305b7538aff73b40 Mon Sep 17 00:00:00 2001 From: shore Date: Thu, 6 Apr 2023 16:07:45 +0000 Subject: [PATCH 01/13] Adding workflow .github/actions/acctest/action.yml .github/actions/tf-install/action.yml .github/workflows/acceptance.yml --- .github/actions/acctest/action.yml | 63 ++++++++ .github/actions/tf-install/action.yml | 21 +++ .github/workflows/acceptance.yml | 212 ++++++++++++++++++++++++++ 3 files changed, 296 insertions(+) create mode 100644 .github/actions/acctest/action.yml create mode 100644 .github/actions/tf-install/action.yml create mode 100644 .github/workflows/acceptance.yml diff --git a/.github/actions/acctest/action.yml b/.github/actions/acctest/action.yml new file mode 100644 index 00000000..5859cba8 --- /dev/null +++ b/.github/actions/acctest/action.yml @@ -0,0 +1,63 @@ +name: acctest +inputs: + provider-test-infra-dir: + required: false + provider-go-test-dir: + required: false + provider-go-test-tags: + required: false + default: '' + provider-tf-apply: + required: false + default: terraform apply -auto-approve +runs: + using: composite + steps: + - uses: "./.github/actions/tf-install" + - uses: actions/checkout@v3.5.0 + - name: download and install AWS CLI + run: |- + curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" + echo -e "${AWS_CLI_GPG_KEY}" | gpg --import + curl -o awscliv2.sig https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip.sig + gpg --verify awscliv2.sig awscliv2.zip + unzip awscliv2.zip + sudo ./aws/install + if: "'aws' == ${{ inputs.provider-test-infra-dir }}" + shell: bash + - name: set assume-role creds + run: |- + CREDENTIALS="$(aws sts assume-role --role-arn ${SERVICE_GO_DISCOVER_TESTS_ROLE_ARN} --role-session-name build-${{ github.sha }} | jq '.Credentials')" + echo "export AWS_ACCESS_KEY_ID=$(echo $CREDENTIALS | jq -r '.AccessKeyId')" >> $BASH_ENV + echo "export AWS_SECRET_ACCESS_KEY=$(echo $CREDENTIALS | jq -r '.SecretAccessKey')" >> $BASH_ENV + echo "export AWS_SESSION_TOKEN=$(echo $CREDENTIALS | jq -r '.SessionToken')" >> $BASH_ENV + if: "'aws' == ${{ inputs.provider-test-infra-dir }}" + shell: bash + - run: terraform init + working-directory: "./test/tf/${{ inputs.provider-test-infra-dir }}" + shell: bash + - run: "${{ inputs.provider-tf-apply }}" + working-directory: "./test/tf/${{ inputs.provider-test-infra-dir }}" + shell: bash + - run: mkdir -p /tmp/test-results + shell: bash + - name: Run provider tests + run: |- + gotestsum -f standard-verbose --junitfile ${TEST_RESULTS}/results.xml -- \ + -run ${{ inputs.provider-go-test-tags }} \ + -v ./provider/${{ inputs.provider-go-test-dir }} + if: "${{ inputs.provider-go-test-tags }}" + shell: bash + - name: Run provider tests + run: |- + gotestsum -f standard-verbose --junitfile ${TEST_RESULTS}/results.xml -- \ + -v ./provider/${{ inputs.provider-go-test-dir }} + if: "${{ !(${{ inputs.provider-go-test-tags }}) }}" + shell: bash + - uses: actions/upload-artifact@v3.1.1 + with: + path: "/tmp/test-results" + - run: terraform destroy --force + working-directory: "./test/tf/${{ inputs.provider-test-infra-dir }}" + if: always() + shell: bash \ No newline at end of file diff --git a/.github/actions/tf-install/action.yml b/.github/actions/tf-install/action.yml new file mode 100644 index 00000000..14acf79b --- /dev/null +++ b/.github/actions/tf-install/action.yml @@ -0,0 +1,21 @@ +name: tf-install +inputs: + version: + required: false + default: 0.12.24 + os: + required: false + default: linux + arch: + required: false + default: amd64 +runs: + using: composite + steps: + - name: download Terraform + run: |- + curl -L -o /tmp/terraform.zip \ + https://releases.hashicorp.com/terraform/${{ inputs.version }}/terraform_${{ inputs.version }}_${{ inputs.os }}_${{ inputs.arch }}.zip + shell: bash + - run: unzip -d /go/bin /tmp/terraform.zip + shell: bash \ No newline at end of file diff --git a/.github/workflows/acceptance.yml b/.github/workflows/acceptance.yml new file mode 100644 index 00000000..cf1b3af1 --- /dev/null +++ b/.github/workflows/acceptance.yml @@ -0,0 +1,212 @@ +name: hashicorp/go-discover/acceptance +on: + push: + branches: + - master +env: + ALICLOUD_ACCESS_KEY: xxxxxxx + ALICLOUD_REGION: xxxxxxx + ALICLOUD_SECRET_KEY: xxxxxxx + ARM_CLIENT_ID: xxxxxxx + ARM_CLIENT_SECRET: xxxxxxx + ARM_ENVIRONMENT: xxxxxxx + ARM_SUBSCRIPTION_ID: xxxxxxx + ARM_TENANT_ID: xxxxxxx + AWS_ACCESS_KEY_ID: xxxxxxx + AWS_CLI_GPG_KEY: xxxxxxx + AWS_REGION: xxxxxxx + AWS_SECRET_ACCESS_KEY: xxxxxxx + DIGITALOCEAN_TOKEN: xxxxxxx + GOOGLE_CREDENTIALS: xxxxxxx + GOOGLE_PROJECT: xxxxxxx + GOOGLE_ZONE: xxxxxxx + PACKET_AUTH_TOKEN: xxxxxxx + PACKET_PROJECT: xxxxxxx + SCALEWAY_ORGANIZATION: xxxxxxx + SCW_ACCESS_KEY: xxxxxxx + SCW_DEFAULT_PROJECT_ID: xxxxxxx + SCW_SECRET_KEY: xxxxxxx + SERVICE_GO_DISCOVER_TESTS_ROLE_ARN: xxxxxxx + TENCENTCLOUD_SECRET_ID: xxxxxxx + TENCENTCLOUD_SECRET_KEY: xxxxxxx + TENCENT_REGION: xxxxxxx + TF_VAR_packet_project: xxxxxxx + TRITON_ACCOUNT: xxxxxxx + TRITON_KEY_ID: xxxxxxx + TRITON_URL: xxxxxxx +jobs: + go-test: + runs-on: ubuntu-latest + container: + image: docker.mirror.hashicorp.services/circleci/golang:1.13.15 + steps: + - uses: actions/checkout@v3.5.0 + - name: restore_cache + uses: actions/cache@v3.3.1 + with: + key: go-mod-test-v1-{{ checksum "go.sum" }} + restore-keys: go-mod-test-v1-{{ checksum "go.sum" }} + path: "/go/pkg/mod" + - name: Run go tests + run: |- + mkdir -p /tmp/test-results + gotestsum -f standard-verbose --junitfile ${TEST_RESULTS}/results.xml . + - uses: actions/upload-artifact@v3.1.1 + with: + path: "/tmp/test-results" + - run: go mod download + - name: Check go mod tidy + run: |- + go mod tidy + git diff --exit-code + alicloud-provider: + if: # GitHub does not currently support regular expressions inside if conditions +# github.ref != 'refs/heads//pull\/[0-9]+/' + runs-on: ubuntu-latest + container: + image: docker.mirror.hashicorp.services/circleci/golang:1.13.15 + needs: + - go-test + steps: + - uses: actions/checkout@v3.5.0 + - uses: "./.github/actions/acctest" + with: + provider-test-infra-dir: aliyun + provider-go-test-dir: aliyun + aws-provider: + if: # GitHub does not currently support regular expressions inside if conditions +# github.ref != 'refs/heads//pull\/[0-9]+/' + runs-on: ubuntu-latest + container: + image: docker.mirror.hashicorp.services/circleci/golang:1.13.15 + needs: + - go-test + steps: + - uses: actions/checkout@v3.5.0 + - uses: "./.github/actions/acctest" + with: + provider-test-infra-dir: aws + provider-go-test-dir: aws + azure-vmss-provider: + if: # GitHub does not currently support regular expressions inside if conditions +# github.ref != 'refs/heads//pull\/[0-9]+/' + runs-on: ubuntu-latest + container: + image: docker.mirror.hashicorp.services/circleci/golang:1.13.15 + needs: + - go-test + steps: + - uses: actions/checkout@v3.5.0 + - uses: "./.github/actions/acctest" + with: + provider-test-infra-dir: azure-vmss + provider-go-test-dir: azure + provider-go-test-tags: TestVmScaleSetAddrs + azurerm-provider: + if: # GitHub does not currently support regular expressions inside if conditions +# github.ref != 'refs/heads//pull\/[0-9]+/' + runs-on: ubuntu-latest + container: + image: docker.mirror.hashicorp.services/circleci/golang:1.13.15 + needs: + - go-test + steps: + - uses: actions/checkout@v3.5.0 + - uses: "./.github/actions/acctest" + with: + provider-test-infra-dir: azurerm + provider-go-test-dir: azure + provider-go-test-tags: TestTagAddrs + digitalocean-provider: + if: # GitHub does not currently support regular expressions inside if conditions +# github.ref != 'refs/heads//pull\/[0-9]+/' + runs-on: ubuntu-latest + container: + image: docker.mirror.hashicorp.services/circleci/golang:1.13.15 + needs: + - go-test + steps: + - uses: actions/checkout@v3.5.0 + - uses: "./.github/actions/acctest" + with: + provider-test-infra-dir: digitalocean + provider-go-test-dir: digitalocean + gce-provider: + if: # GitHub does not currently support regular expressions inside if conditions +# github.ref != 'refs/heads//pull\/[0-9]+/' + runs-on: ubuntu-latest + container: + image: docker.mirror.hashicorp.services/circleci/golang:1.13.15 + needs: + - go-test + steps: + - uses: actions/checkout@v3.5.0 + - uses: "./.github/actions/acctest" + with: + provider-test-infra-dir: gce + provider-go-test-dir: gce + k8s-provider: + if: # GitHub does not currently support regular expressions inside if conditions +# github.ref != 'refs/heads//pull\/[0-9]+/' + runs-on: ubuntu-latest + container: + image: docker.mirror.hashicorp.services/circleci/golang:1.13.15 + needs: + - go-test + steps: + - uses: actions/checkout@v3.5.0 + - uses: "./.github/actions/acctest" + with: + provider-test-infra-dir: k8s + provider-go-test-dir: k8s + provider-tf-apply: terraform apply -target google_container_cluster.cluster -auto-approve && terraform apply -auto-approve + packet-provider: + if: # GitHub does not currently support regular expressions inside if conditions +# github.ref != 'refs/heads//pull\/[0-9]+/' + runs-on: ubuntu-latest + container: + image: docker.mirror.hashicorp.services/circleci/golang:1.13.15 + needs: + - go-test + steps: + - uses: actions/checkout@v3.5.0 + - uses: "./.github/actions/acctest" + with: + provider-test-infra-dir: packet + provider-go-test-dir: packet + scaleway-provider: + if: # GitHub does not currently support regular expressions inside if conditions +# github.ref != 'refs/heads//pull\/[0-9]+/' + runs-on: ubuntu-latest + container: + image: docker.mirror.hashicorp.services/circleci/golang:1.13.15 + needs: + - go-test + steps: + - uses: actions/checkout@v3.5.0 + - uses: "./.github/actions/acctest" + with: + provider-test-infra-dir: scaleway + provider-go-test-dir: scaleway + triton-provider: + if: # GitHub does not currently support regular expressions inside if conditions +# github.ref != 'refs/heads//pull\/[0-9]+/' + runs-on: ubuntu-latest + container: + image: docker.mirror.hashicorp.services/circleci/golang:1.13.15 + needs: + - go-test + steps: + - uses: actions/checkout@v3.5.0 + # Ensure parameter if_key_exists is set correctly + - name: Install SSH key + uses: shimataro/ssh-key-action@v2.5.0 + with: + key: "${{ secrets.CIRCLE_CI_SSH_KEY }}" + name: circle_ci_id_rsa + known_hosts: "${{ secrets.CIRCLE_CI_KNOWN_HOSTS }}" + if_key_exists: fail + - uses: "./.github/actions/acctest" + with: + provider-test-infra-dir: triton + provider-go-test-dir: triton From 65094e8fd58a17f29bd39d089a9322706c05ad11 Mon Sep 17 00:00:00 2001 From: shore Date: Thu, 6 Apr 2023 16:07:55 +0000 Subject: [PATCH 02/13] SHA-pin all 3rd-party actions --- .github/actions/acctest/action.yml | 4 ++-- .github/workflows/acceptance.yml | 28 ++++++++++++++-------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/actions/acctest/action.yml b/.github/actions/acctest/action.yml index 5859cba8..f0a95460 100644 --- a/.github/actions/acctest/action.yml +++ b/.github/actions/acctest/action.yml @@ -14,7 +14,7 @@ runs: using: composite steps: - uses: "./.github/actions/tf-install" - - uses: actions/checkout@v3.5.0 + - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 - name: download and install AWS CLI run: |- curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" @@ -54,7 +54,7 @@ runs: -v ./provider/${{ inputs.provider-go-test-dir }} if: "${{ !(${{ inputs.provider-go-test-tags }}) }}" shell: bash - - uses: actions/upload-artifact@v3.1.1 + - uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 with: path: "/tmp/test-results" - run: terraform destroy --force diff --git a/.github/workflows/acceptance.yml b/.github/workflows/acceptance.yml index cf1b3af1..025210c9 100644 --- a/.github/workflows/acceptance.yml +++ b/.github/workflows/acceptance.yml @@ -40,9 +40,9 @@ jobs: container: image: docker.mirror.hashicorp.services/circleci/golang:1.13.15 steps: - - uses: actions/checkout@v3.5.0 + - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 - name: restore_cache - uses: actions/cache@v3.3.1 + uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 with: key: go-mod-test-v1-{{ checksum "go.sum" }} restore-keys: go-mod-test-v1-{{ checksum "go.sum" }} @@ -51,7 +51,7 @@ jobs: run: |- mkdir -p /tmp/test-results gotestsum -f standard-verbose --junitfile ${TEST_RESULTS}/results.xml . - - uses: actions/upload-artifact@v3.1.1 + - uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 with: path: "/tmp/test-results" - run: go mod download @@ -68,7 +68,7 @@ jobs: needs: - go-test steps: - - uses: actions/checkout@v3.5.0 + - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 - uses: "./.github/actions/acctest" with: provider-test-infra-dir: aliyun @@ -82,7 +82,7 @@ jobs: needs: - go-test steps: - - uses: actions/checkout@v3.5.0 + - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 - uses: "./.github/actions/acctest" with: provider-test-infra-dir: aws @@ -96,7 +96,7 @@ jobs: needs: - go-test steps: - - uses: actions/checkout@v3.5.0 + - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 - uses: "./.github/actions/acctest" with: provider-test-infra-dir: azure-vmss @@ -111,7 +111,7 @@ jobs: needs: - go-test steps: - - uses: actions/checkout@v3.5.0 + - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 - uses: "./.github/actions/acctest" with: provider-test-infra-dir: azurerm @@ -126,7 +126,7 @@ jobs: needs: - go-test steps: - - uses: actions/checkout@v3.5.0 + - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 - uses: "./.github/actions/acctest" with: provider-test-infra-dir: digitalocean @@ -140,7 +140,7 @@ jobs: needs: - go-test steps: - - uses: actions/checkout@v3.5.0 + - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 - uses: "./.github/actions/acctest" with: provider-test-infra-dir: gce @@ -154,7 +154,7 @@ jobs: needs: - go-test steps: - - uses: actions/checkout@v3.5.0 + - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 - uses: "./.github/actions/acctest" with: provider-test-infra-dir: k8s @@ -169,7 +169,7 @@ jobs: needs: - go-test steps: - - uses: actions/checkout@v3.5.0 + - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 - uses: "./.github/actions/acctest" with: provider-test-infra-dir: packet @@ -183,7 +183,7 @@ jobs: needs: - go-test steps: - - uses: actions/checkout@v3.5.0 + - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 - uses: "./.github/actions/acctest" with: provider-test-infra-dir: scaleway @@ -197,10 +197,10 @@ jobs: needs: - go-test steps: - - uses: actions/checkout@v3.5.0 + - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 # Ensure parameter if_key_exists is set correctly - name: Install SSH key - uses: shimataro/ssh-key-action@v2.5.0 + uses: shimataro/ssh-key-action@685d0f20da72e4b53cc81d373a2ed0a867770e46 # v2.5.1 with: key: "${{ secrets.CIRCLE_CI_SSH_KEY }}" name: circle_ci_id_rsa From 948ffbd2b6b69f6ae652728d73b10453b9b1cdc4 Mon Sep 17 00:00:00 2001 From: shore Date: Thu, 6 Apr 2023 16:07:55 +0000 Subject: [PATCH 03/13] Restrict workflow permissions --- .github/workflows/acceptance.yml | 204 ++++++++++++++++--------------- 1 file changed, 103 insertions(+), 101 deletions(-) diff --git a/.github/workflows/acceptance.yml b/.github/workflows/acceptance.yml index 025210c9..224d8305 100644 --- a/.github/workflows/acceptance.yml +++ b/.github/workflows/acceptance.yml @@ -2,7 +2,7 @@ name: hashicorp/go-discover/acceptance on: push: branches: - - master + - master env: ALICLOUD_ACCESS_KEY: xxxxxxx ALICLOUD_REGION: xxxxxxx @@ -40,173 +40,175 @@ jobs: container: image: docker.mirror.hashicorp.services/circleci/golang:1.13.15 steps: - - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 - - name: restore_cache - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 - with: - key: go-mod-test-v1-{{ checksum "go.sum" }} - restore-keys: go-mod-test-v1-{{ checksum "go.sum" }} - path: "/go/pkg/mod" - - name: Run go tests - run: |- - mkdir -p /tmp/test-results - gotestsum -f standard-verbose --junitfile ${TEST_RESULTS}/results.xml . - - uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 - with: - path: "/tmp/test-results" - - run: go mod download - - name: Check go mod tidy - run: |- - go mod tidy - git diff --exit-code + - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 + - name: restore_cache + uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 + with: + key: go-mod-test-v1-{{ checksum "go.sum" }} + restore-keys: go-mod-test-v1-{{ checksum "go.sum" }} + path: "/go/pkg/mod" + - name: Run go tests + run: |- + mkdir -p /tmp/test-results + gotestsum -f standard-verbose --junitfile ${TEST_RESULTS}/results.xml . + - uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 + with: + path: "/tmp/test-results" + - run: go mod download + - name: Check go mod tidy + run: |- + go mod tidy + git diff --exit-code alicloud-provider: if: # GitHub does not currently support regular expressions inside if conditions -# github.ref != 'refs/heads//pull\/[0-9]+/' + # github.ref != 'refs/heads//pull\/[0-9]+/' runs-on: ubuntu-latest container: image: docker.mirror.hashicorp.services/circleci/golang:1.13.15 needs: - - go-test + - go-test steps: - - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 - - uses: "./.github/actions/acctest" - with: - provider-test-infra-dir: aliyun - provider-go-test-dir: aliyun + - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 + - uses: "./.github/actions/acctest" + with: + provider-test-infra-dir: aliyun + provider-go-test-dir: aliyun aws-provider: if: # GitHub does not currently support regular expressions inside if conditions -# github.ref != 'refs/heads//pull\/[0-9]+/' + # github.ref != 'refs/heads//pull\/[0-9]+/' runs-on: ubuntu-latest container: image: docker.mirror.hashicorp.services/circleci/golang:1.13.15 needs: - - go-test + - go-test steps: - - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 - - uses: "./.github/actions/acctest" - with: - provider-test-infra-dir: aws - provider-go-test-dir: aws + - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 + - uses: "./.github/actions/acctest" + with: + provider-test-infra-dir: aws + provider-go-test-dir: aws azure-vmss-provider: if: # GitHub does not currently support regular expressions inside if conditions -# github.ref != 'refs/heads//pull\/[0-9]+/' + # github.ref != 'refs/heads//pull\/[0-9]+/' runs-on: ubuntu-latest container: image: docker.mirror.hashicorp.services/circleci/golang:1.13.15 needs: - - go-test + - go-test steps: - - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 - - uses: "./.github/actions/acctest" - with: - provider-test-infra-dir: azure-vmss - provider-go-test-dir: azure - provider-go-test-tags: TestVmScaleSetAddrs + - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 + - uses: "./.github/actions/acctest" + with: + provider-test-infra-dir: azure-vmss + provider-go-test-dir: azure + provider-go-test-tags: TestVmScaleSetAddrs azurerm-provider: if: # GitHub does not currently support regular expressions inside if conditions -# github.ref != 'refs/heads//pull\/[0-9]+/' + # github.ref != 'refs/heads//pull\/[0-9]+/' runs-on: ubuntu-latest container: image: docker.mirror.hashicorp.services/circleci/golang:1.13.15 needs: - - go-test + - go-test steps: - - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 - - uses: "./.github/actions/acctest" - with: - provider-test-infra-dir: azurerm - provider-go-test-dir: azure - provider-go-test-tags: TestTagAddrs + - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 + - uses: "./.github/actions/acctest" + with: + provider-test-infra-dir: azurerm + provider-go-test-dir: azure + provider-go-test-tags: TestTagAddrs digitalocean-provider: if: # GitHub does not currently support regular expressions inside if conditions -# github.ref != 'refs/heads//pull\/[0-9]+/' + # github.ref != 'refs/heads//pull\/[0-9]+/' runs-on: ubuntu-latest container: image: docker.mirror.hashicorp.services/circleci/golang:1.13.15 needs: - - go-test + - go-test steps: - - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 - - uses: "./.github/actions/acctest" - with: - provider-test-infra-dir: digitalocean - provider-go-test-dir: digitalocean + - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 + - uses: "./.github/actions/acctest" + with: + provider-test-infra-dir: digitalocean + provider-go-test-dir: digitalocean gce-provider: if: # GitHub does not currently support regular expressions inside if conditions -# github.ref != 'refs/heads//pull\/[0-9]+/' + # github.ref != 'refs/heads//pull\/[0-9]+/' runs-on: ubuntu-latest container: image: docker.mirror.hashicorp.services/circleci/golang:1.13.15 needs: - - go-test + - go-test steps: - - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 - - uses: "./.github/actions/acctest" - with: - provider-test-infra-dir: gce - provider-go-test-dir: gce + - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 + - uses: "./.github/actions/acctest" + with: + provider-test-infra-dir: gce + provider-go-test-dir: gce k8s-provider: if: # GitHub does not currently support regular expressions inside if conditions -# github.ref != 'refs/heads//pull\/[0-9]+/' + # github.ref != 'refs/heads//pull\/[0-9]+/' runs-on: ubuntu-latest container: image: docker.mirror.hashicorp.services/circleci/golang:1.13.15 needs: - - go-test + - go-test steps: - - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 - - uses: "./.github/actions/acctest" - with: - provider-test-infra-dir: k8s - provider-go-test-dir: k8s - provider-tf-apply: terraform apply -target google_container_cluster.cluster -auto-approve && terraform apply -auto-approve + - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 + - uses: "./.github/actions/acctest" + with: + provider-test-infra-dir: k8s + provider-go-test-dir: k8s + provider-tf-apply: terraform apply -target google_container_cluster.cluster -auto-approve && terraform apply -auto-approve packet-provider: if: # GitHub does not currently support regular expressions inside if conditions -# github.ref != 'refs/heads//pull\/[0-9]+/' + # github.ref != 'refs/heads//pull\/[0-9]+/' runs-on: ubuntu-latest container: image: docker.mirror.hashicorp.services/circleci/golang:1.13.15 needs: - - go-test + - go-test steps: - - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 - - uses: "./.github/actions/acctest" - with: - provider-test-infra-dir: packet - provider-go-test-dir: packet + - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 + - uses: "./.github/actions/acctest" + with: + provider-test-infra-dir: packet + provider-go-test-dir: packet scaleway-provider: if: # GitHub does not currently support regular expressions inside if conditions -# github.ref != 'refs/heads//pull\/[0-9]+/' + # github.ref != 'refs/heads//pull\/[0-9]+/' runs-on: ubuntu-latest container: image: docker.mirror.hashicorp.services/circleci/golang:1.13.15 needs: - - go-test + - go-test steps: - - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 - - uses: "./.github/actions/acctest" - with: - provider-test-infra-dir: scaleway - provider-go-test-dir: scaleway + - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 + - uses: "./.github/actions/acctest" + with: + provider-test-infra-dir: scaleway + provider-go-test-dir: scaleway triton-provider: if: # GitHub does not currently support regular expressions inside if conditions -# github.ref != 'refs/heads//pull\/[0-9]+/' + # github.ref != 'refs/heads//pull\/[0-9]+/' runs-on: ubuntu-latest container: image: docker.mirror.hashicorp.services/circleci/golang:1.13.15 needs: - - go-test + - go-test steps: - - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 - # Ensure parameter if_key_exists is set correctly - - name: Install SSH key - uses: shimataro/ssh-key-action@685d0f20da72e4b53cc81d373a2ed0a867770e46 # v2.5.1 - with: - key: "${{ secrets.CIRCLE_CI_SSH_KEY }}" - name: circle_ci_id_rsa - known_hosts: "${{ secrets.CIRCLE_CI_KNOWN_HOSTS }}" - if_key_exists: fail - - uses: "./.github/actions/acctest" - with: - provider-test-infra-dir: triton - provider-go-test-dir: triton + - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 + # Ensure parameter if_key_exists is set correctly + - name: Install SSH key + uses: shimataro/ssh-key-action@685d0f20da72e4b53cc81d373a2ed0a867770e46 # v2.5.1 + with: + key: "${{ secrets.CIRCLE_CI_SSH_KEY }}" + name: circle_ci_id_rsa + known_hosts: "${{ secrets.CIRCLE_CI_KNOWN_HOSTS }}" + if_key_exists: fail + - uses: "./.github/actions/acctest" + with: + provider-test-infra-dir: triton + provider-go-test-dir: triton +permissions: + contents: read From 4a5b74fcbb88311d70c109f0e81e2dd62534f9b1 Mon Sep 17 00:00:00 2001 From: shore Date: Thu, 6 Apr 2023 16:07:56 +0000 Subject: [PATCH 04/13] Add actionslint --- .github/workflows/actionlint.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .github/workflows/actionlint.yml diff --git a/.github/workflows/actionlint.yml b/.github/workflows/actionlint.yml new file mode 100644 index 00000000..be82ea5e --- /dev/null +++ b/.github/workflows/actionlint.yml @@ -0,0 +1,14 @@ +# If the repository is public, be sure to change to GitHub hosted runners +name: Lint GitHub Actions Workflows +on: + push: + pull_request: +permissions: + contents: read +jobs: + actionlint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 + - name: "Check workflow files" + uses: docker://docker.mirror.hashicorp.services/rhysd/actionlint:latest From 7e392a1209146827b01cfc7aafa4e61847966d53 Mon Sep 17 00:00:00 2001 From: shore Date: Thu, 6 Apr 2023 16:07:56 +0000 Subject: [PATCH 05/13] Add dependabot --- .github/dependabot.yml | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..8a90ccaa --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,7 @@ +version: 2 + +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" \ No newline at end of file From 80115771f3c97973d1d6c5ac7d0a50c21b60ddc4 Mon Sep 17 00:00:00 2001 From: shore Date: Thu, 6 Apr 2023 16:07:56 +0000 Subject: [PATCH 06/13] Add CODEOWNERS --- CODEOWNERS | 1 + 1 file changed, 1 insertion(+) create mode 100644 CODEOWNERS diff --git a/CODEOWNERS b/CODEOWNERS new file mode 100644 index 00000000..7d1ad67b --- /dev/null +++ b/CODEOWNERS @@ -0,0 +1 @@ +# Submit a helpdesk ticket to add any team other than yours referenced in the CODEOWNERS file -- they must be added to collaborators and teams in the repository settings with maintainer privileges. Remove this file as soon as you have completed this From 117b5957afdad195da99ba7f346684d03a6db84e Mon Sep 17 00:00:00 2001 From: Brian Shore Date: Thu, 6 Apr 2023 09:18:03 -0700 Subject: [PATCH 07/13] Remove CircleCI configuration --- .circleci/config.yml | 255 ------------------------------------------- 1 file changed, 255 deletions(-) delete mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 99329304..00000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,255 +0,0 @@ -version: 2.1 - -locals: - ignore_prs: &ignore_prs - branches: - # Forked pull requests have CIRCLE_BRANCH set to pull/XXX - ignore: /pull\/[0-9]+/ - -# reusable 'executor' object for jobs -executors: - go: - docker: - - image: docker.mirror.hashicorp.services/circleci/golang:1.13.15 - environment: - - TEST_RESULTS: /tmp/test-results # path to where test results are saved - -# reusable 'commands' to be added as a step in jobs -commands: - tf-install: - description: Install Terraform binary - parameters: - version: - type: string - default: 0.12.24 - os: - type: string - default: linux - arch: - type: string - default: amd64 - steps: - - run: - name: download Terraform - command: | - curl -L -o /tmp/terraform.zip \ - https://releases.hashicorp.com/terraform/<< parameters.version >>/terraform_<< parameters.version >>_<< parameters.os >>_<< parameters.arch >>.zip - - run: unzip -d /go/bin /tmp/terraform.zip - - acctest: - description: Run acceptance tests for cloud providers - parameters: - provider-test-infra-dir: - type: string - provider-go-test-dir: - type: string - provider-go-test-tags: - type: string - default: "" - provider-tf-apply: - type: string - default: "terraform apply -auto-approve" - steps: - - tf-install - - checkout - - - when: - condition: - equal: [aws, << parameters.provider-test-infra-dir >>] - steps: - - run: - name: download and install AWS CLI - command: | - curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" - echo -e "${AWS_CLI_GPG_KEY}" | gpg --import - curl -o awscliv2.sig https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip.sig - gpg --verify awscliv2.sig awscliv2.zip - unzip awscliv2.zip - sudo ./aws/install - - run: - name: set assume-role creds - command: | - CREDENTIALS="$(aws sts assume-role --role-arn ${SERVICE_GO_DISCOVER_TESTS_ROLE_ARN} --role-session-name build-${CIRCLE_SHA1} | jq '.Credentials')" - echo "export AWS_ACCESS_KEY_ID=$(echo $CREDENTIALS | jq -r '.AccessKeyId')" >> $BASH_ENV - echo "export AWS_SECRET_ACCESS_KEY=$(echo $CREDENTIALS | jq -r '.SecretAccessKey')" >> $BASH_ENV - echo "export AWS_SESSION_TOKEN=$(echo $CREDENTIALS | jq -r '.SessionToken')" >> $BASH_ENV - # spin up infrastructure - - run: - working_directory: ./test/tf/<< parameters.provider-test-infra-dir >> - command: terraform init - - run: - working_directory: ./test/tf/<< parameters.provider-test-infra-dir >> - command: << parameters.provider-tf-apply >> - - - run: mkdir -p /tmp/test-results - - # run acceptance tests - - when: - condition: << parameters.provider-go-test-tags >> - steps: - - run: - name: Run provider tests - command: | - gotestsum -f standard-verbose --junitfile ${TEST_RESULTS}/results.xml -- \ - -run << parameters.provider-go-test-tags >> \ - -v ./provider/<< parameters.provider-go-test-dir >> - - unless: - condition: << parameters.provider-go-test-tags >> - steps: - - run: - name: Run provider tests - command: | - gotestsum -f standard-verbose --junitfile ${TEST_RESULTS}/results.xml -- \ - -v ./provider/<< parameters.provider-go-test-dir >> - - - store_test_results: - path: /tmp/test-results - - # teardown infrastructure - - run: - working_directory: ./test/tf/<< parameters.provider-test-infra-dir >> - command: terraform destroy --force - when: always - -jobs: - go-test: - executor: go - steps: - - checkout - - restore_cache: - keys: - - go-mod-test-v1-{{ checksum "go.sum" }} - - run: - name: Run go tests - command: | - mkdir -p /tmp/test-results - gotestsum -f standard-verbose --junitfile ${TEST_RESULTS}/results.xml . - - save_cache: - key: go-mod-test-v1-{{ checksum "go.sum" }} - paths: - - /go/pkg/mod - - store_test_results: - path: /tmp/test-results - - run: go mod download - - run: - name: Check go mod tidy - command: | - go mod tidy - git diff --exit-code - - alicloud-provider: - executor: go - steps: - - acctest: - provider-test-infra-dir: aliyun - provider-go-test-dir: aliyun - aws-provider: - executor: go - steps: - - acctest: - provider-test-infra-dir: aws - provider-go-test-dir: aws - azure-vmss-provider: - executor: go - steps: - - acctest: - provider-test-infra-dir: azure-vmss - provider-go-test-dir: azure - provider-go-test-tags: TestVmScaleSetAddrs - azurerm-provider: - executor: go - steps: - - acctest: - provider-test-infra-dir: azurerm - provider-go-test-dir: azure - provider-go-test-tags: TestTagAddrs - digitalocean-provider: - executor: go - steps: - - acctest: - provider-test-infra-dir: digitalocean - provider-go-test-dir: digitalocean - gce-provider: - executor: go - steps: - - acctest: - provider-test-infra-dir: gce - provider-go-test-dir: gce - k8s-provider: - executor: go - steps: - - acctest: - provider-test-infra-dir: k8s - provider-go-test-dir: k8s - # We have to apply in two stages because an output of the resource of one provider is then used as the input - # to the k8s provider. Specifically we are getting auth information from the GKE cluster into the k8s provider. - # https://www.terraform.io/docs/providers/kubernetes/index.html#stacking-with-managed-kubernetes-cluster-resources - provider-tf-apply: "terraform apply -target google_container_cluster.cluster -auto-approve && terraform apply -auto-approve" - packet-provider: - executor: go - steps: - - acctest: - provider-test-infra-dir: packet - provider-go-test-dir: packet - - scaleway-provider: - executor: go - steps: - - acctest: - provider-test-infra-dir: scaleway - provider-go-test-dir: scaleway - triton-provider: - executor: go - steps: - - add_ssh_keys: - fingerprints: - - "3e:c7:ee:67:a5:e7:bc:eb:be:b8:9a:0e:ee:fb:e2:33" - - acctest: - provider-test-infra-dir: triton - provider-go-test-dir: triton - -workflows: - version: 2 - acceptance: - jobs: - - go-test - - alicloud-provider: - requires: - - go-test - filters: *ignore_prs - - aws-provider: - requires: - - go-test - filters: *ignore_prs - - azure-vmss-provider: - requires: - - go-test - filters: *ignore_prs - - azurerm-provider: - requires: - - go-test - filters: *ignore_prs - - digitalocean-provider: - requires: - - go-test - filters: *ignore_prs - - gce-provider: - requires: - - go-test - filters: *ignore_prs - - k8s-provider: - requires: - - go-test - filters: *ignore_prs - - packet-provider: - requires: - - go-test - filters: *ignore_prs - - scaleway-provider: - requires: - - go-test - filters: *ignore_prs - - triton-provider: - requires: - - go-test - filters: *ignore_prs From 8b04f015ae69ecd79278172abcf38b6798661611 Mon Sep 17 00:00:00 2001 From: Brian Shore Date: Thu, 6 Apr 2023 09:20:34 -0700 Subject: [PATCH 08/13] Remove unused local actions --- .github/actions/tf-install/action.yml | 21 --------------------- 1 file changed, 21 deletions(-) delete mode 100644 .github/actions/tf-install/action.yml diff --git a/.github/actions/tf-install/action.yml b/.github/actions/tf-install/action.yml deleted file mode 100644 index 14acf79b..00000000 --- a/.github/actions/tf-install/action.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: tf-install -inputs: - version: - required: false - default: 0.12.24 - os: - required: false - default: linux - arch: - required: false - default: amd64 -runs: - using: composite - steps: - - name: download Terraform - run: |- - curl -L -o /tmp/terraform.zip \ - https://releases.hashicorp.com/terraform/${{ inputs.version }}/terraform_${{ inputs.version }}_${{ inputs.os }}_${{ inputs.arch }}.zip - shell: bash - - run: unzip -d /go/bin /tmp/terraform.zip - shell: bash \ No newline at end of file From d6e7c8faf69d3de2158b7bd07ff6fb0957559077 Mon Sep 17 00:00:00 2001 From: Brian Shore Date: Thu, 6 Apr 2023 09:18:08 -0700 Subject: [PATCH 09/13] Update migration --- .github/actions/acctest/action.yml | 103 +++++----- .github/dependabot.yml | 7 +- .github/workflows/acceptance.yml | 302 +++++++++++++++++++---------- .github/workflows/actionlint.yml | 9 +- CODEOWNERS | 2 +- go.mod | 2 +- 6 files changed, 264 insertions(+), 161 deletions(-) diff --git a/.github/actions/acctest/action.yml b/.github/actions/acctest/action.yml index f0a95460..9c367a9c 100644 --- a/.github/actions/acctest/action.yml +++ b/.github/actions/acctest/action.yml @@ -1,4 +1,5 @@ name: acctest + inputs: provider-test-infra-dir: required: false @@ -10,54 +11,60 @@ inputs: provider-tf-apply: required: false default: terraform apply -auto-approve + aws-region: + description: 'AWS region for resources; only used for AWS tests' + required: false + aws-role-arn: + description: 'AWS role to assume before testing; only used for AWS tests' + required: false + runs: using: composite steps: - - uses: "./.github/actions/tf-install" - - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 - - name: download and install AWS CLI - run: |- - curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" - echo -e "${AWS_CLI_GPG_KEY}" | gpg --import - curl -o awscliv2.sig https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip.sig - gpg --verify awscliv2.sig awscliv2.zip - unzip awscliv2.zip - sudo ./aws/install - if: "'aws' == ${{ inputs.provider-test-infra-dir }}" - shell: bash - - name: set assume-role creds - run: |- - CREDENTIALS="$(aws sts assume-role --role-arn ${SERVICE_GO_DISCOVER_TESTS_ROLE_ARN} --role-session-name build-${{ github.sha }} | jq '.Credentials')" - echo "export AWS_ACCESS_KEY_ID=$(echo $CREDENTIALS | jq -r '.AccessKeyId')" >> $BASH_ENV - echo "export AWS_SECRET_ACCESS_KEY=$(echo $CREDENTIALS | jq -r '.SecretAccessKey')" >> $BASH_ENV - echo "export AWS_SESSION_TOKEN=$(echo $CREDENTIALS | jq -r '.SessionToken')" >> $BASH_ENV - if: "'aws' == ${{ inputs.provider-test-infra-dir }}" - shell: bash - - run: terraform init - working-directory: "./test/tf/${{ inputs.provider-test-infra-dir }}" - shell: bash - - run: "${{ inputs.provider-tf-apply }}" - working-directory: "./test/tf/${{ inputs.provider-test-infra-dir }}" - shell: bash - - run: mkdir -p /tmp/test-results - shell: bash - - name: Run provider tests - run: |- - gotestsum -f standard-verbose --junitfile ${TEST_RESULTS}/results.xml -- \ - -run ${{ inputs.provider-go-test-tags }} \ - -v ./provider/${{ inputs.provider-go-test-dir }} - if: "${{ inputs.provider-go-test-tags }}" - shell: bash - - name: Run provider tests - run: |- - gotestsum -f standard-verbose --junitfile ${TEST_RESULTS}/results.xml -- \ - -v ./provider/${{ inputs.provider-go-test-dir }} - if: "${{ !(${{ inputs.provider-go-test-tags }}) }}" - shell: bash - - uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 - with: - path: "/tmp/test-results" - - run: terraform destroy --force - working-directory: "./test/tf/${{ inputs.provider-test-infra-dir }}" - if: always() - shell: bash \ No newline at end of file + - uses: hashicorp/setup-terraform@v2.0.3 + with: + terraform_version: '0.12.24' + + - name: Configure AWS Credentials + if: inputs.provider-test-infra-dir == 'aws' + uses: aws-actions/configure-aws-credentials@e1e17a757e536f70e52b5a12b2e8d1d1c60e04ef # v2.0.0 + with: + role-to-assume: ${{ inputs.aws-role-arn }} + aws-region: ${{ inputs.aws-region }} + + - name: Terraform Init + run: terraform init + shell: bash + working-directory: "./test/tf/${{ inputs.provider-test-infra-dir }}" + #- name: Terraform Apply + # run: "${{ inputs.provider-tf-apply }}" + # shell: bash + # working-directory: "./test/tf/${{ inputs.provider-test-infra-dir }}" + + - name: Run provider tests + run: |- + mkdir -p "$TEST_RESULTS" + gotestsum -f standard-verbose --junitfile ${TEST_RESULTS}/results.xml -- \ + -run ${{ inputs.provider-go-test-tags }} \ + -v ./provider/${{ inputs.provider-go-test-dir }} + if: inputs.provider-go-test-tags != '' + shell: bash + + - name: Run provider tests + if: inputs.provider-go-test-tags == '' + shell: bash + run: |- + mkdir -p "$TEST_RESULTS" + gotestsum -f standard-verbose --junitfile "${TEST_RESULTS}/results.xml" -- \ + -v ./provider/${{ inputs.provider-go-test-dir }} + + - uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 + with: + path: ${{ env.TEST_RESULTS }} + name: tests-${{ inputs.provider-test-infra-dir }} + + - name: Terraform Destroy + run: terraform destroy --force + if: always() + shell: bash + working-directory: "./test/tf/${{ inputs.provider-test-infra-dir }}" diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 8a90ccaa..38e2bf94 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -4,4 +4,9 @@ updates: - package-ecosystem: "github-actions" directory: "/" schedule: - interval: "daily" \ No newline at end of file + interval: "daily" + + - package-ecosystem: "gomod" + directory: "/" + schedule: + interval: "weekly" diff --git a/.github/workflows/acceptance.yml b/.github/workflows/acceptance.yml index 224d8305..03191cc4 100644 --- a/.github/workflows/acceptance.yml +++ b/.github/workflows/acceptance.yml @@ -1,214 +1,302 @@ -name: hashicorp/go-discover/acceptance +name: Acceptance + on: push: - branches: - - master + +permissions: + contents: read + env: - ALICLOUD_ACCESS_KEY: xxxxxxx - ALICLOUD_REGION: xxxxxxx - ALICLOUD_SECRET_KEY: xxxxxxx - ARM_CLIENT_ID: xxxxxxx - ARM_CLIENT_SECRET: xxxxxxx - ARM_ENVIRONMENT: xxxxxxx - ARM_SUBSCRIPTION_ID: xxxxxxx - ARM_TENANT_ID: xxxxxxx - AWS_ACCESS_KEY_ID: xxxxxxx - AWS_CLI_GPG_KEY: xxxxxxx - AWS_REGION: xxxxxxx - AWS_SECRET_ACCESS_KEY: xxxxxxx - DIGITALOCEAN_TOKEN: xxxxxxx - GOOGLE_CREDENTIALS: xxxxxxx - GOOGLE_PROJECT: xxxxxxx - GOOGLE_ZONE: xxxxxxx - PACKET_AUTH_TOKEN: xxxxxxx - PACKET_PROJECT: xxxxxxx - SCALEWAY_ORGANIZATION: xxxxxxx - SCW_ACCESS_KEY: xxxxxxx - SCW_DEFAULT_PROJECT_ID: xxxxxxx - SCW_SECRET_KEY: xxxxxxx - SERVICE_GO_DISCOVER_TESTS_ROLE_ARN: xxxxxxx - TENCENTCLOUD_SECRET_ID: xxxxxxx - TENCENTCLOUD_SECRET_KEY: xxxxxxx - TENCENT_REGION: xxxxxxx - TF_VAR_packet_project: xxxxxxx - TRITON_ACCOUNT: xxxxxxx - TRITON_KEY_ID: xxxxxxx - TRITON_URL: xxxxxxx + TEST_RESULTS: /tmp/test-results + jobs: - go-test: + lint: runs-on: ubuntu-latest - container: - image: docker.mirror.hashicorp.services/circleci/golang:1.13.15 steps: - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 - - name: restore_cache - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 - with: - key: go-mod-test-v1-{{ checksum "go.sum" }} - restore-keys: go-mod-test-v1-{{ checksum "go.sum" }} - path: "/go/pkg/mod" - - name: Run go tests - run: |- - mkdir -p /tmp/test-results - gotestsum -f standard-verbose --junitfile ${TEST_RESULTS}/results.xml . - - uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 + - uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0 with: - path: "/tmp/test-results" + go-version-file: go.mod - run: go mod download - name: Check go mod tidy run: |- go mod tidy git diff --exit-code + - name: Check Formatting + run: |- + files=$(go fmt ./...) + if [ -n "$files" ]; then + echo "The following file(s) do not conform to go fmt:" + echo "$files" + exit 1 + fi + + go-test: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + go-version: + - '1.14' # oldest supported; named in go.mod + - 'oldstable' + - 'stable' + steps: + - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 + - uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0 + with: + go-version: ${{ matrix.go-version }} + - uses: autero1/action-gotestsum@2e48af62f5248bd3b014f598cd1aa69a01dd36e3 # v1.0.0 + with: + gotestsum_version: 1.9.0 + + - name: Run go tests + run: |- + mkdir -p "$TEST_RESULTS" + gotestsum -f standard-verbose --junitfile "${TEST_RESULTS}/results.xml" . + - uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 + with: + path: ${{ env.TEST_RESULTS }} + name: tests-linux + alicloud-provider: - if: # GitHub does not currently support regular expressions inside if conditions - # github.ref != 'refs/heads//pull\/[0-9]+/' + # don't run on fork PRs + if: github.repository_owner == 'hashicorp' runs-on: ubuntu-latest - container: - image: docker.mirror.hashicorp.services/circleci/golang:1.13.15 needs: - go-test + env: + ALICLOUD_ACCESS_KEY: ${{ secrets.ALICLOUD_ACCESS_KEY }} + ALICLOUD_SECRET_KEY: ${{ secrets.ALICLOUD_SECRET_KEY }} + # XXX + # ALICLOUD_REGION: xxx steps: - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 + - uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0 + with: + go-version: 'stable' + - uses: autero1/action-gotestsum@2e48af62f5248bd3b014f598cd1aa69a01dd36e3 # v1.0.0 + with: + gotestsum_version: 1.9.0 + - uses: "./.github/actions/acctest" with: provider-test-infra-dir: aliyun provider-go-test-dir: aliyun + aws-provider: - if: # GitHub does not currently support regular expressions inside if conditions - # github.ref != 'refs/heads//pull\/[0-9]+/' + # don't run on fork PRs + if: github.repository_owner == 'hashicorp' runs-on: ubuntu-latest - container: - image: docker.mirror.hashicorp.services/circleci/golang:1.13.15 needs: - go-test + env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_REGION: ${{ vars.AWS_REGION }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} steps: - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 + - uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0 + with: + go-version: 'stable' + - uses: autero1/action-gotestsum@2e48af62f5248bd3b014f598cd1aa69a01dd36e3 # v1.0.0 + with: + gotestsum_version: 1.9.0 + - uses: "./.github/actions/acctest" with: provider-test-infra-dir: aws provider-go-test-dir: aws + aws-region: ${{ vars.AWS_REGION }} + aws-role-arn: ${{ secrets.SERVICE_GO_DISCOVER_TESTS_ROLE_ARN }} + azure-vmss-provider: - if: # GitHub does not currently support regular expressions inside if conditions - # github.ref != 'refs/heads//pull\/[0-9]+/' + # don't run on fork PRs + if: github.repository_owner == 'hashicorp' runs-on: ubuntu-latest - container: - image: docker.mirror.hashicorp.services/circleci/golang:1.13.15 needs: - go-test + env: + ARM_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID }} + ARM_CLIENT_SECRET: ${{ secrets.ARM_CLIENT_SECRET }} + ARM_ENVIRONMENT: ${{ vars.ARM_ENVIRONMENT }} + ARM_SUBSCRIPTION_ID: ${{ secrets.ARM_SUBSCRIPTION_ID }} + ARM_TENANT_ID: ${{ secrets.ARM_TENANT_ID }} steps: - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 + - uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0 + with: + go-version: 'stable' + - uses: autero1/action-gotestsum@2e48af62f5248bd3b014f598cd1aa69a01dd36e3 # v1.0.0 + with: + gotestsum_version: 1.9.0 + - uses: "./.github/actions/acctest" with: provider-test-infra-dir: azure-vmss provider-go-test-dir: azure provider-go-test-tags: TestVmScaleSetAddrs + azurerm-provider: - if: # GitHub does not currently support regular expressions inside if conditions - # github.ref != 'refs/heads//pull\/[0-9]+/' + # don't run on fork PRs + if: github.repository_owner == 'hashicorp' runs-on: ubuntu-latest - container: - image: docker.mirror.hashicorp.services/circleci/golang:1.13.15 needs: - go-test + env: + ARM_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID }} + ARM_CLIENT_SECRET: ${{ secrets.ARM_CLIENT_SECRET }} + ARM_ENVIRONMENT: ${{ vars.ARM_ENVIRONMENT }} + ARM_SUBSCRIPTION_ID: ${{ secrets.ARM_SUBSCRIPTION_ID }} + ARM_TENANT_ID: ${{ secrets.ARM_TENANT_ID }} steps: - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 + - uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0 + with: + go-version: 'stable' + - uses: autero1/action-gotestsum@2e48af62f5248bd3b014f598cd1aa69a01dd36e3 # v1.0.0 + with: + gotestsum_version: 1.9.0 + - uses: "./.github/actions/acctest" with: provider-test-infra-dir: azurerm provider-go-test-dir: azure provider-go-test-tags: TestTagAddrs + digitalocean-provider: - if: # GitHub does not currently support regular expressions inside if conditions - # github.ref != 'refs/heads//pull\/[0-9]+/' + # don't run on fork PRs + if: github.repository_owner == 'hashicorp' runs-on: ubuntu-latest - container: - image: docker.mirror.hashicorp.services/circleci/golang:1.13.15 needs: - go-test + env: + DIGITALOCEAN_TOKEN: ${{ secrets.DIGITALOCEAN_TOKEN }} steps: - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 + - uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0 + with: + go-version: 'stable' + - uses: autero1/action-gotestsum@2e48af62f5248bd3b014f598cd1aa69a01dd36e3 # v1.0.0 + with: + gotestsum_version: 1.9.0 + - uses: "./.github/actions/acctest" with: provider-test-infra-dir: digitalocean provider-go-test-dir: digitalocean + gce-provider: - if: # GitHub does not currently support regular expressions inside if conditions - # github.ref != 'refs/heads//pull\/[0-9]+/' + # don't run on fork PRs + if: github.repository_owner == 'hashicorp' runs-on: ubuntu-latest - container: - image: docker.mirror.hashicorp.services/circleci/golang:1.13.15 needs: - go-test + env: + GOOGLE_CREDENTIALS: ${{ secrets.GOOGLE_CREDENTIALS }} + GOOGLE_PROJECT: ${{ secrets.GOOGLE_PROJECT }} + GOOGLE_ZONE: ${{ vars.GOOGLE_ZONE }} steps: - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 + - uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0 + with: + go-version: 'stable' + - uses: autero1/action-gotestsum@2e48af62f5248bd3b014f598cd1aa69a01dd36e3 # v1.0.0 + with: + gotestsum_version: 1.9.0 + - uses: "./.github/actions/acctest" with: provider-test-infra-dir: gce provider-go-test-dir: gce + k8s-provider: - if: # GitHub does not currently support regular expressions inside if conditions - # github.ref != 'refs/heads//pull\/[0-9]+/' + # don't run on fork PRs + if: github.repository_owner == 'hashicorp' runs-on: ubuntu-latest - container: - image: docker.mirror.hashicorp.services/circleci/golang:1.13.15 needs: - go-test steps: - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 + - uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0 + with: + go-version: 'stable' + - uses: autero1/action-gotestsum@2e48af62f5248bd3b014f598cd1aa69a01dd36e3 # v1.0.0 + with: + gotestsum_version: 1.9.0 + - uses: "./.github/actions/acctest" with: provider-test-infra-dir: k8s provider-go-test-dir: k8s provider-tf-apply: terraform apply -target google_container_cluster.cluster -auto-approve && terraform apply -auto-approve + packet-provider: - if: # GitHub does not currently support regular expressions inside if conditions - # github.ref != 'refs/heads//pull\/[0-9]+/' + # don't run on fork PRs + if: github.repository_owner == 'hashicorp' runs-on: ubuntu-latest - container: - image: docker.mirror.hashicorp.services/circleci/golang:1.13.15 needs: - go-test + env: + TF_VAR_packet_project: ${{ secrets.PACKET_PROJECT }} + PACKET_AUTH_TOKEN: ${{ secrets.PACKET_AUTH_TOKEN }} + PACKET_PROJECT: ${{ secrets.PACKET_PROJECT }} steps: - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 + - uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0 + with: + go-version: 'stable' + - uses: autero1/action-gotestsum@2e48af62f5248bd3b014f598cd1aa69a01dd36e3 # v1.0.0 + with: + gotestsum_version: 1.9.0 + - uses: "./.github/actions/acctest" with: provider-test-infra-dir: packet provider-go-test-dir: packet - scaleway-provider: - if: # GitHub does not currently support regular expressions inside if conditions - # github.ref != 'refs/heads//pull\/[0-9]+/' - runs-on: ubuntu-latest - container: - image: docker.mirror.hashicorp.services/circleci/golang:1.13.15 - needs: - - go-test - steps: - - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 - - uses: "./.github/actions/acctest" - with: - provider-test-infra-dir: scaleway - provider-go-test-dir: scaleway + +## The account for using this provider is broken. If we want to resume regression testing against this +## provider, the account must be fixed or replaced (and creds added to repo or Vault). +# scaleway-provider: +# # don't run on fork PRs +# if: github.repository_owner == 'hashicorp' +# runs-on: ubuntu-latest +# needs: +# - go-test +# steps: +# - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 +# - uses: "./.github/actions/acctest" +# with: +# provider-test-infra-dir: scaleway +# provider-go-test-dir: scaleway + triton-provider: - if: # GitHub does not currently support regular expressions inside if conditions - # github.ref != 'refs/heads//pull\/[0-9]+/' + # don't run on fork PRs + if: github.repository_owner == 'hashicorp' runs-on: ubuntu-latest - container: - image: docker.mirror.hashicorp.services/circleci/golang:1.13.15 needs: - go-test + env: + TRITON_URL: ${{ vars.TRITON_URL }} + TRITON_ACCOUNT: ${{ secrets.TRITON_ACCOUNT }} + TRITON_KEY_ID: ${{ secrets.TRITON_KEY_ID }} steps: - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 - # Ensure parameter if_key_exists is set correctly - - name: Install SSH key - uses: shimataro/ssh-key-action@685d0f20da72e4b53cc81d373a2ed0a867770e46 # v2.5.1 + - uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0 + with: + go-version: 'stable' + - uses: autero1/action-gotestsum@2e48af62f5248bd3b014f598cd1aa69a01dd36e3 # v1.0.0 with: - key: "${{ secrets.CIRCLE_CI_SSH_KEY }}" - name: circle_ci_id_rsa - known_hosts: "${{ secrets.CIRCLE_CI_KNOWN_HOSTS }}" - if_key_exists: fail + gotestsum_version: 1.9.0 + + # Ensure parameter if_key_exists is set correctly + #- name: Install SSH key + # uses: shimataro/ssh-key-action@685d0f20da72e4b53cc81d373a2ed0a867770e46 # v2.5.1 + # with: + # key: "${{ secrets.CIRCLE_CI_SSH_KEY }}" + # name: circle_ci_id_rsa + # known_hosts: "${{ secrets.CIRCLE_CI_KNOWN_HOSTS }}" + # if_key_exists: fail - uses: "./.github/actions/acctest" with: provider-test-infra-dir: triton provider-go-test-dir: triton -permissions: - contents: read diff --git a/.github/workflows/actionlint.yml b/.github/workflows/actionlint.yml index be82ea5e..d24ac17b 100644 --- a/.github/workflows/actionlint.yml +++ b/.github/workflows/actionlint.yml @@ -1,14 +1,17 @@ -# If the repository is public, be sure to change to GitHub hosted runners name: Lint GitHub Actions Workflows + on: push: - pull_request: + permissions: contents: read + jobs: actionlint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 + - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 - name: "Check workflow files" uses: docker://docker.mirror.hashicorp.services/rhysd/actionlint:latest + with: + args: -color diff --git a/CODEOWNERS b/CODEOWNERS index 7d1ad67b..1b35cec3 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -1 +1 @@ -# Submit a helpdesk ticket to add any team other than yours referenced in the CODEOWNERS file -- they must be added to collaborators and teams in the repository settings with maintainer privileges. Remove this file as soon as you have completed this +* @hashicorp/release-engineering diff --git a/go.mod b/go.mod index cbeb3f05..f52fbb16 100644 --- a/go.mod +++ b/go.mod @@ -43,4 +43,4 @@ require ( k8s.io/client-go v0.18.2 ) -go 1.12 +go 1.14 From bb6c50af1e66c7b6e338c8196803c6ad6b421ab9 Mon Sep 17 00:00:00 2001 From: John Murret Date: Thu, 13 Apr 2023 14:10:26 -0600 Subject: [PATCH 10/13] enable scleway acceptance test --- .github/workflows/acceptance.yml | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/acceptance.yml b/.github/workflows/acceptance.yml index 03191cc4..996b53b2 100644 --- a/.github/workflows/acceptance.yml +++ b/.github/workflows/acceptance.yml @@ -254,20 +254,20 @@ jobs: provider-test-infra-dir: packet provider-go-test-dir: packet -## The account for using this provider is broken. If we want to resume regression testing against this -## provider, the account must be fixed or replaced (and creds added to repo or Vault). -# scaleway-provider: -# # don't run on fork PRs -# if: github.repository_owner == 'hashicorp' -# runs-on: ubuntu-latest -# needs: -# - go-test -# steps: -# - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 -# - uses: "./.github/actions/acctest" -# with: -# provider-test-infra-dir: scaleway -# provider-go-test-dir: scaleway + # The account for using this provider is broken. If we want to resume regression testing against this + # provider, the account must be fixed or replaced (and creds added to repo or Vault). + scaleway-provider: + # don't run on fork PRs + if: github.repository_owner == 'hashicorp' + runs-on: ubuntu-latest + needs: + - go-test + steps: + - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 + - uses: "./.github/actions/acctest" + with: + provider-test-infra-dir: scaleway + provider-go-test-dir: scaleway triton-provider: # don't run on fork PRs From 01d57731b83d990d786b08d1c57a501438b108ee Mon Sep 17 00:00:00 2001 From: John Murret Date: Thu, 13 Apr 2023 14:20:43 -0600 Subject: [PATCH 11/13] add success job --- .github/workflows/acceptance.yml | 167 +++++++++++++++++++------------ 1 file changed, 104 insertions(+), 63 deletions(-) diff --git a/.github/workflows/acceptance.yml b/.github/workflows/acceptance.yml index 996b53b2..febb4847 100644 --- a/.github/workflows/acceptance.yml +++ b/.github/workflows/acceptance.yml @@ -1,3 +1,8 @@ +############################# +# NOTE: The below providers that are commented out have account token issues +# related to neglect and aremost likely expired or somesort of billing issue. +# There is a backlog item to fix these accounts and re-enable these tests. +############################# name: Acceptance on: @@ -83,7 +88,7 @@ jobs: provider-test-infra-dir: aliyun provider-go-test-dir: aliyun - aws-provider: + # aws-provider: # don't run on fork PRs if: github.repository_owner == 'hashicorp' runs-on: ubuntu-latest @@ -163,74 +168,74 @@ jobs: provider-go-test-dir: azure provider-go-test-tags: TestTagAddrs - digitalocean-provider: - # don't run on fork PRs - if: github.repository_owner == 'hashicorp' - runs-on: ubuntu-latest - needs: - - go-test - env: - DIGITALOCEAN_TOKEN: ${{ secrets.DIGITALOCEAN_TOKEN }} - steps: - - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 - - uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0 - with: - go-version: 'stable' - - uses: autero1/action-gotestsum@2e48af62f5248bd3b014f598cd1aa69a01dd36e3 # v1.0.0 - with: - gotestsum_version: 1.9.0 + # digitalocean-provider: + # # don't run on fork PRs + # if: github.repository_owner == 'hashicorp' + # runs-on: ubuntu-latest + # needs: + # - go-test + # env: + # DIGITALOCEAN_TOKEN: ${{ secrets.DIGITALOCEAN_TOKEN }} + # steps: + # - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 + # - uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0 + # with: + # go-version: 'stable' + # - uses: autero1/action-gotestsum@2e48af62f5248bd3b014f598cd1aa69a01dd36e3 # v1.0.0 + # with: + # gotestsum_version: 1.9.0 - - uses: "./.github/actions/acctest" - with: - provider-test-infra-dir: digitalocean - provider-go-test-dir: digitalocean + # - uses: "./.github/actions/acctest" + # with: + # provider-test-infra-dir: digitalocean + # provider-go-test-dir: digitalocean - gce-provider: - # don't run on fork PRs - if: github.repository_owner == 'hashicorp' - runs-on: ubuntu-latest - needs: - - go-test - env: - GOOGLE_CREDENTIALS: ${{ secrets.GOOGLE_CREDENTIALS }} - GOOGLE_PROJECT: ${{ secrets.GOOGLE_PROJECT }} - GOOGLE_ZONE: ${{ vars.GOOGLE_ZONE }} - steps: - - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 - - uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0 - with: - go-version: 'stable' - - uses: autero1/action-gotestsum@2e48af62f5248bd3b014f598cd1aa69a01dd36e3 # v1.0.0 - with: - gotestsum_version: 1.9.0 + # gce-provider: + # # don't run on fork PRs + # if: github.repository_owner == 'hashicorp' + # runs-on: ubuntu-latest + # needs: + # - go-test + # env: + # GOOGLE_CREDENTIALS: ${{ secrets.GOOGLE_CREDENTIALS }} + # GOOGLE_PROJECT: ${{ secrets.GOOGLE_PROJECT }} + # GOOGLE_ZONE: ${{ vars.GOOGLE_ZONE }} + # steps: + # - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 + # - uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0 + # with: + # go-version: 'stable' + # - uses: autero1/action-gotestsum@2e48af62f5248bd3b014f598cd1aa69a01dd36e3 # v1.0.0 + # with: + # gotestsum_version: 1.9.0 - - uses: "./.github/actions/acctest" - with: - provider-test-infra-dir: gce - provider-go-test-dir: gce + # - uses: "./.github/actions/acctest" + # with: + # provider-test-infra-dir: gce + # provider-go-test-dir: gce - k8s-provider: - # don't run on fork PRs - if: github.repository_owner == 'hashicorp' - runs-on: ubuntu-latest - needs: - - go-test - steps: - - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 - - uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0 - with: - go-version: 'stable' - - uses: autero1/action-gotestsum@2e48af62f5248bd3b014f598cd1aa69a01dd36e3 # v1.0.0 - with: - gotestsum_version: 1.9.0 + # k8s-provider: + # # don't run on fork PRs + # if: github.repository_owner == 'hashicorp' + # runs-on: ubuntu-latest + # needs: + # - go-test + # steps: + # - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 + # - uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0 + # with: + # go-version: 'stable' + # - uses: autero1/action-gotestsum@2e48af62f5248bd3b014f598cd1aa69a01dd36e3 # v1.0.0 + # with: + # gotestsum_version: 1.9.0 - - uses: "./.github/actions/acctest" - with: - provider-test-infra-dir: k8s - provider-go-test-dir: k8s - provider-tf-apply: terraform apply -target google_container_cluster.cluster -auto-approve && terraform apply -auto-approve + # - uses: "./.github/actions/acctest" + # with: + # provider-test-infra-dir: k8s + # provider-go-test-dir: k8s + # provider-tf-apply: terraform apply -target google_container_cluster.cluster -auto-approve && terraform apply -auto-approve - packet-provider: + # packet-provider: # don't run on fork PRs if: github.repository_owner == 'hashicorp' runs-on: ubuntu-latest @@ -300,3 +305,39 @@ jobs: with: provider-test-infra-dir: triton provider-go-test-dir: triton + + # This is job is required for branch protection as a required gihub check + # because GitHub actions show up as checks at the job level and not the + # workflow level. This is currently a feature request: + # https://github.com/orgs/community/discussions/12395 + # + # This job must: + # - be placed after the fanout of a workflow so that everything fans back in + # to this job. + # - "need" any job that is part of the fan out / fan in + # - implement the if logic because we have conditional jobs + # (go-test-enteprise) that this job needs and this would potentially get + # skipped if a previous job got skipped. So we use the if clause to make + # sure it does not get skipped. + + acceptance-success: + needs: + - lint + - go-test + - alicloud-provider + # - aws-provider + - azure-vmss-provider + - azurerm-provider + # - digitalocean-provider + # - gce-provider + # - k8s-provider + # - packet-provider + # - scaleway-provider + # - triton-provider + runs-on: ${{ fromJSON(needs.setup.outputs.compute-small) }} + if: | + (always() && ! cancelled()) && + !contains(needs.*.result, 'failure') && + !contains(needs.*.result, 'cancelled') + steps: + - run: echo "go-tests succeeded" From be78fa9d457732b7d591e320a29a911df1d0f15b Mon Sep 17 00:00:00 2001 From: John Murret Date: Thu, 13 Apr 2023 14:24:02 -0600 Subject: [PATCH 12/13] add success job --- .github/workflows/acceptance.yml | 174 +++++++++++++++---------------- 1 file changed, 86 insertions(+), 88 deletions(-) diff --git a/.github/workflows/acceptance.yml b/.github/workflows/acceptance.yml index febb4847..12e8393a 100644 --- a/.github/workflows/acceptance.yml +++ b/.github/workflows/acceptance.yml @@ -89,30 +89,30 @@ jobs: provider-go-test-dir: aliyun # aws-provider: - # don't run on fork PRs - if: github.repository_owner == 'hashicorp' - runs-on: ubuntu-latest - needs: - - go-test - env: - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_REGION: ${{ vars.AWS_REGION }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - steps: - - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 - - uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0 - with: - go-version: 'stable' - - uses: autero1/action-gotestsum@2e48af62f5248bd3b014f598cd1aa69a01dd36e3 # v1.0.0 - with: - gotestsum_version: 1.9.0 + # # don't run on fork PRs + # if: github.repository_owner == 'hashicorp' + # runs-on: ubuntu-latest + # needs: + # - go-test + # env: + # AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + # AWS_REGION: ${{ vars.AWS_REGION }} + # AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + # steps: + # - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 + # - uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0 + # with: + # go-version: 'stable' + # - uses: autero1/action-gotestsum@2e48af62f5248bd3b014f598cd1aa69a01dd36e3 # v1.0.0 + # with: + # gotestsum_version: 1.9.0 - - uses: "./.github/actions/acctest" - with: - provider-test-infra-dir: aws - provider-go-test-dir: aws - aws-region: ${{ vars.AWS_REGION }} - aws-role-arn: ${{ secrets.SERVICE_GO_DISCOVER_TESTS_ROLE_ARN }} + # - uses: "./.github/actions/acctest" + # with: + # provider-test-infra-dir: aws + # provider-go-test-dir: aws + # aws-region: ${{ vars.AWS_REGION }} + # aws-role-arn: ${{ secrets.SERVICE_GO_DISCOVER_TESTS_ROLE_ARN }} azure-vmss-provider: # don't run on fork PRs @@ -236,75 +236,73 @@ jobs: # provider-tf-apply: terraform apply -target google_container_cluster.cluster -auto-approve && terraform apply -auto-approve # packet-provider: - # don't run on fork PRs - if: github.repository_owner == 'hashicorp' - runs-on: ubuntu-latest - needs: - - go-test - env: - TF_VAR_packet_project: ${{ secrets.PACKET_PROJECT }} - PACKET_AUTH_TOKEN: ${{ secrets.PACKET_AUTH_TOKEN }} - PACKET_PROJECT: ${{ secrets.PACKET_PROJECT }} - steps: - - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 - - uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0 - with: - go-version: 'stable' - - uses: autero1/action-gotestsum@2e48af62f5248bd3b014f598cd1aa69a01dd36e3 # v1.0.0 - with: - gotestsum_version: 1.9.0 + # # don't run on fork PRs + # if: github.repository_owner == 'hashicorp' + # runs-on: ubuntu-latest + # needs: + # - go-test + # env: + # TF_VAR_packet_project: ${{ secrets.PACKET_PROJECT }} + # PACKET_AUTH_TOKEN: ${{ secrets.PACKET_AUTH_TOKEN }} + # PACKET_PROJECT: ${{ secrets.PACKET_PROJECT }} + # steps: + # - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 + # - uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0 + # with: + # go-version: 'stable' + # - uses: autero1/action-gotestsum@2e48af62f5248bd3b014f598cd1aa69a01dd36e3 # v1.0.0 + # with: + # gotestsum_version: 1.9.0 - - uses: "./.github/actions/acctest" - with: - provider-test-infra-dir: packet - provider-go-test-dir: packet + # - uses: "./.github/actions/acctest" + # with: + # provider-test-infra-dir: packet + # provider-go-test-dir: packet - # The account for using this provider is broken. If we want to resume regression testing against this - # provider, the account must be fixed or replaced (and creds added to repo or Vault). - scaleway-provider: - # don't run on fork PRs - if: github.repository_owner == 'hashicorp' - runs-on: ubuntu-latest - needs: - - go-test - steps: - - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 - - uses: "./.github/actions/acctest" - with: - provider-test-infra-dir: scaleway - provider-go-test-dir: scaleway + # scaleway-provider: + # # don't run on fork PRs + # if: github.repository_owner == 'hashicorp' + # runs-on: ubuntu-latest + # needs: + # - go-test + # steps: + # - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 + # - uses: "./.github/actions/acctest" + # with: + # provider-test-infra-dir: scaleway + # provider-go-test-dir: scaleway - triton-provider: - # don't run on fork PRs - if: github.repository_owner == 'hashicorp' - runs-on: ubuntu-latest - needs: - - go-test - env: - TRITON_URL: ${{ vars.TRITON_URL }} - TRITON_ACCOUNT: ${{ secrets.TRITON_ACCOUNT }} - TRITON_KEY_ID: ${{ secrets.TRITON_KEY_ID }} - steps: - - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 - - uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0 - with: - go-version: 'stable' - - uses: autero1/action-gotestsum@2e48af62f5248bd3b014f598cd1aa69a01dd36e3 # v1.0.0 - with: - gotestsum_version: 1.9.0 + # triton-provider: + # # don't run on fork PRs + # if: github.repository_owner == 'hashicorp' + # runs-on: ubuntu-latest + # needs: + # - go-test + # env: + # TRITON_URL: ${{ vars.TRITON_URL }} + # TRITON_ACCOUNT: ${{ secrets.TRITON_ACCOUNT }} + # TRITON_KEY_ID: ${{ secrets.TRITON_KEY_ID }} + # steps: + # - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 + # - uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0 + # with: + # go-version: 'stable' + # - uses: autero1/action-gotestsum@2e48af62f5248bd3b014f598cd1aa69a01dd36e3 # v1.0.0 + # with: + # gotestsum_version: 1.9.0 - # Ensure parameter if_key_exists is set correctly - #- name: Install SSH key - # uses: shimataro/ssh-key-action@685d0f20da72e4b53cc81d373a2ed0a867770e46 # v2.5.1 - # with: - # key: "${{ secrets.CIRCLE_CI_SSH_KEY }}" - # name: circle_ci_id_rsa - # known_hosts: "${{ secrets.CIRCLE_CI_KNOWN_HOSTS }}" - # if_key_exists: fail - - uses: "./.github/actions/acctest" - with: - provider-test-infra-dir: triton - provider-go-test-dir: triton + # # Ensure parameter if_key_exists is set correctly + # #- name: Install SSH key + # # uses: shimataro/ssh-key-action@685d0f20da72e4b53cc81d373a2ed0a867770e46 # v2.5.1 + # # with: + # # key: "${{ secrets.CIRCLE_CI_SSH_KEY }}" + # # name: circle_ci_id_rsa + # # known_hosts: "${{ secrets.CIRCLE_CI_KNOWN_HOSTS }}" + # # if_key_exists: fail + # - uses: "./.github/actions/acctest" + # with: + # provider-test-infra-dir: triton + # provider-go-test-dir: triton # This is job is required for branch protection as a required gihub check # because GitHub actions show up as checks at the job level and not the From ef4b89b0ca4312f582bd597d44cfdaaee3624685 Mon Sep 17 00:00:00 2001 From: John Murret Date: Thu, 13 Apr 2023 14:25:39 -0600 Subject: [PATCH 13/13] fix copy pasta --- .github/workflows/acceptance.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/acceptance.yml b/.github/workflows/acceptance.yml index 12e8393a..d4a5af80 100644 --- a/.github/workflows/acceptance.yml +++ b/.github/workflows/acceptance.yml @@ -332,7 +332,7 @@ jobs: # - packet-provider # - scaleway-provider # - triton-provider - runs-on: ${{ fromJSON(needs.setup.outputs.compute-small) }} + runs-on: ubuntu-latest if: | (always() && ! cancelled()) && !contains(needs.*.result, 'failure') &&