-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Using Terratest for Testing the Examples (#47)
Using Terratest for testing the examples
- Loading branch information
Showing
47 changed files
with
958 additions
and
349 deletions.
There are no files selected for viewing
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
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
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,12 @@ jobs: | |
&& chmod +x $HOME/bin/swagger | ||
echo "::add-path::$HOME/bin" | ||
- uses: actions/cache@v2 | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- name: install go stuff | ||
run: | | ||
go get -v \ | ||
|
@@ -40,6 +46,192 @@ jobs: | |
run: | | ||
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.27.0 | ||
- name: test provider | ||
- name: compile the provider | ||
run: | | ||
make build | ||
- name: Upload terraform provider | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: provider | ||
path: bin/* | ||
acc: | ||
name: Acception Tests | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
harbor_deployments: | ||
- helm_chart_version: 1.4.0 | ||
harbor_path: "/api/v2.0" | ||
- helm_chart_version: 1.4.1 | ||
harbor_path: "/api/v2.0" | ||
# TODO: https://github.com/nolte/terraform-provider-harbor/issues/40 | ||
#- helm_chart_version: 1.3.2 | ||
# harbor_path: "/api" | ||
steps: | ||
- name: Set up Go 1.x | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ^1.14 | ||
id: go | ||
|
||
- name: Get dependencies | ||
run: | | ||
SWAGGER_VERSION=v0.23.0 | ||
mkdir -p $HOME/bin | ||
curl -Lo $HOME/bin/swagger https://github.com/go-swagger/go-swagger/releases/download/${SWAGGER_VERSION}/swagger_linux_amd64 \ | ||
&& chmod +x $HOME/bin/swagger | ||
echo "::add-path::$HOME/bin" | ||
- name: install go stuff | ||
run: | | ||
go get -v \ | ||
github.com/magefile/mage \ | ||
github.com/evanphx/json-patch/cmd/json-patch | ||
echo "::add-path::$(go env GOPATH)/bin" | ||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v2 | ||
|
||
- name: install golangci-lint | ||
run: | | ||
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.27.0 | ||
- name: Generate Api Client from Swagger Spac | ||
run: | | ||
make generate | ||
# https://github.com/engineerd/setup-kind | ||
- uses: engineerd/[email protected] | ||
with: | ||
skipClusterCreation: true | ||
|
||
- name: Starting the Kind Cluster | ||
run: | | ||
./scripts/tst-00-prepare-kind.sh | ||
- name: configure kind kubeconfig | ||
run: | | ||
kind export kubeconfig | ||
kubectl cluster-info | ||
kubectl get pods -n kube-system | ||
NODEDNSNAME=$(kubectl get nodes -ojson | jq '.items[0].status.addresses[0].address' -r | sed 's/\./-/g') | ||
echo "::set-env name=INGRESS_DOMAIN::${NODEDNSNAME}.sslip.io" | ||
echo "current-context:" $(kubectl config current-context) | ||
echo "environment-kubeconfig:" ${KUBECONFIG} | ||
- name: install helm3 | ||
run: | | ||
curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash | ||
- name: install harbor | ||
run: | | ||
./scripts/tst-01-prepare-harbor.sh ${INGRESS_DOMAIN} "${{ matrix.harbor_deployments.helm_chart_version }}" | ||
- name: Starting the Acc | ||
run: | | ||
./scripts/tst-15-execute-go-acc.sh "${{ matrix.harbor_deployments.harbor_path }}" | ||
- name: remove the kind cluster | ||
if: ${{ always() }} | ||
run: | | ||
kind delete cluster | ||
acc_terratest: | ||
name: acc-terratest | ||
runs-on: ubuntu-latest | ||
needs: build | ||
#env: | ||
# TF_LOG: TRACE | ||
strategy: | ||
# Workarround, otherwithe the the different matrix jobs faild. | ||
# max-parallel: 1 | ||
fail-fast: false | ||
matrix: | ||
terraform_version: | ||
# - 0.11.14 Out of Support | ||
- 0.12.25 | ||
- 0.12.29 | ||
# - 0.13.0-rc1 # required changes at the cicd structure | ||
harbor_deployments: | ||
- helm_chart_version: 1.4.0 | ||
harbor_path: "/api/v2.0" | ||
- helm_chart_version: 1.4.1 | ||
harbor_path: "/api/v2.0" | ||
# TODO: https://github.com/nolte/terraform-provider-harbor/issues/40 | ||
- helm_chart_version: 1.3.2 | ||
harbor_path: "/api" | ||
steps: | ||
- name: Set up Go 1.x | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ^1.14 | ||
id: go | ||
|
||
- name: Download terraform provider binary | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: provider | ||
path: bin | ||
|
||
- name: install the provider to local terrafomd.d folder | ||
run: | | ||
ls -all bin/* | ||
mkdir -p ~/.terraform.d/plugins/linux_amd64/ | ||
tar -C ~/.terraform.d/plugins/linux_amd64/ -xvf ./bin/terraform-provider-harbor_v0.1.0_linux_amd64.tar.gz | ||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup Terraform | ||
uses: hashicorp/setup-terraform@v1 | ||
with: | ||
terraform_version: ${{ matrix.terraform_version }} | ||
|
||
# https://github.com/engineerd/setup-kind | ||
- uses: engineerd/[email protected] | ||
with: | ||
skipClusterCreation: true | ||
|
||
- name: Starting the Kind Cluster | ||
run: | | ||
./scripts/tst-00-prepare-kind.sh | ||
- name: configure kind kubeconfig | ||
run: | | ||
kind export kubeconfig | ||
kubectl cluster-info | ||
kubectl get pods -n kube-system | ||
NODEDNSNAME=$(kubectl get nodes -ojson | jq '.items[0].status.addresses[0].address' -r | sed 's/\./-/g') | ||
echo "::set-env name=INGRESS_DOMAIN::${NODEDNSNAME}.sslip.io" | ||
echo "current-context:" $(kubectl config current-context) | ||
echo "environment-kubeconfig:" ${KUBECONFIG} | ||
- name: install helm3 | ||
run: | | ||
curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash | ||
- name: install harbor | ||
run: | | ||
./scripts/tst-01-prepare-harbor.sh ${INGRESS_DOMAIN} "${{ matrix.harbor_deployments.helm_chart_version }}" | ||
#- name: install harbor | ||
# run: | | ||
# echo "::set-env name=INGRESS_DOMAIN::harbor.${NODEDNSNAME}.sslip.io" | ||
- name: Wait some Time | ||
run: | | ||
sleep 30 | ||
- name: Starting the Acc | ||
run: | | ||
./scripts/tst-15-execute-classic-acc.sh "${{ matrix.harbor_deployments.harbor_path }}" | ||
- name: read harbor logs core | ||
if: ${{ failure() }} | ||
run: | | ||
kubectl logs -l component=core -n harbor --tail=-1 | ||
- name: read harbor logs jobservice | ||
if: ${{ failure() }} | ||
run: | | ||
kubectl logs -l component=jobservice -n harbor --tail=-1 | ||
- name: remove the kind cluster | ||
if: ${{ always() }} | ||
run: | | ||
kind delete cluster |
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
Oops, something went wrong.