-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
292 changed files
with
105,304 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
name: CLI Build Pipeline | ||
|
||
on: workflow_call | ||
|
||
jobs: | ||
test: | ||
name: Run Generator tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: "1.20" | ||
|
||
- name: Check out code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Terraform latest | ||
uses: hashicorp/setup-terraform@v2 | ||
|
||
- name: Setup Test broker | ||
run: | | ||
mkdir -p $HOME/solace; chmod 777 $HOME/solace | ||
docker run -d -p 8080:8080 -p 55555:55555 --shm-size=1g --env username_admin_globalaccesslevel=admin --env username_admin_password=admin --name=solace \ | ||
--mount type=bind,source=$HOME/solace,destination=/var/lib/solace,ro=false solace/solace-pubsub-standard | ||
while ! curl -s localhost:8080 | grep aurelia ; do sleep 1 ; done | ||
- name: Use local provider | ||
run: | | ||
echo " | ||
provider_installation { | ||
dev_overrides { | ||
\"registry.terraform.io/solaceproducts/solacebroker\" = \"${HOME}/go/bin\" | ||
} | ||
direct {} | ||
}" > ~/.terraformrc | ||
- name: Checkout generator | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: SolaceDev/broker-terraform-provider-generator | ||
token: ${{ secrets.GH_PAT }} # `GH_PAT` is a secret that contains your PAT | ||
path: broker-terraform-provider-generator | ||
ref: "v0.1.0" | ||
|
||
- name: Build and install generator | ||
run: | | ||
pushd broker-terraform-provider-generator | ||
go mod tidy | ||
go install . | ||
ls ~/go/bin | ||
popd | ||
- name: Generate provider code | ||
run: | | ||
SWAGGER_SPEC_NAME=`ls ci/swagger_spec` | ||
echo "Generating code using spec $SWAGGER_SPEC_NAME" | ||
BASE=`pwd` | ||
pushd internal/broker/generated | ||
rm ./* | ||
SEMP_V2_SWAGGER_CONFIG_EXTENDED_JSON="$BASE/ci/swagger_spec/$SWAGGER_SPEC_NAME" ~/go/bin/broker-terraform-provider-generator all | ||
popd | ||
- name: Build provider | ||
run: | | ||
go mod tidy | ||
go install . | ||
ls ~/go/bin | ||
terraform-provider-solacebroker -h | ||
- name: Failure to Generate sample Terraform due to Missing Username for Broker | ||
run: | | ||
SOLACEBROKER_REGISTRY_OVERRIDE=registry.terraform.io/solaceproducts/solacebroker SOLACEBROKER_PASSWORD=admin terraform-provider-solacebroker generate --url=http://localhost:8080 msgVpn solace_broker gha_test.tf || error_code=$? | ||
if [ $error_code -eq 1 ]; then | ||
echo "\nExpected failure accurate" | ||
exit 0 | ||
fi | ||
exit 1 | ||
- name: Failure to Generate sample Terraform due to Authentication wrong for Broker | ||
run: | | ||
SOLACEBROKER_REGISTRY_OVERRIDE=registry.terraform.io/solaceproducts/solacebroker SOLACEBROKER_USERNAME=admin SOLACEBROKER_PASSWORD=wrongpassword terraform-provider-solacebroker generate --url=http://localhost:8080 solacebroker_msg_vpn.default default/msg_vpn gha_test.tf || error_code=$? | ||
if [ $error_code -eq 1 ]; then | ||
echo "\nExpected failure accurate" | ||
exit 0 | ||
fi | ||
exit 1 | ||
- name: Failure to Generate sample Terraform due to Password and Bearer Token Not Present | ||
run: | | ||
SOLACEBROKER_REGISTRY_OVERRIDE=registry.terraform.io/solaceproducts/solacebroker SOLACEBROKER_USERNAME=admin terraform-provider-solacebroker generate --url=http://localhost:8080 solacebroker_msg_vpn.default default/msg_vpn gha_test.tf || error_code=$? | ||
if [ $error_code -eq 1 ]; then | ||
echo "\nExpected failure accurate" | ||
exit 0 | ||
fi | ||
exit 1 | ||
- name: Failure to Generate sample Terraform due to invalid provider specific identifiers | ||
run: | | ||
SOLACEBROKER_REGISTRY_OVERRIDE=registry.terraform.io/solaceproducts/solacebroker SOLACEBROKER_USERNAME=admin terraform-provider-solacebroker generate --url=http://localhost:8080 solacebroker_msg_vpn.default default/msg_vpn gha_test.tf || error_code=$? | ||
if [ $error_code -eq 1 ]; then | ||
echo "\nExpected failure accurate" | ||
exit 0 | ||
fi | ||
exit 1 | ||
- name: Generate sample Terraform for message vpn client | ||
run: | | ||
SOLACEBROKER_REGISTRY_OVERRIDE=registry.terraform.io/solaceproducts/solacebroker SOLACEBROKER_USERNAME=admin SOLACEBROKER_PASSWORD=admin terraform-provider-solacebroker generate --url=http://localhost:8080 solacebroker_msg_vpn_rest_delivery_point.my-rdp default messageVpn.tf | ||
cat messageVpn.tf | ||
- name: Generate sample Terraform for message vpn | ||
run: | | ||
SOLACEBROKER_REGISTRY_OVERRIDE=registry.terraform.io/solaceproducts/solacebroker SOLACEBROKER_USERNAME=admin SOLACEBROKER_PASSWORD=admin terraform-provider-solacebroker generate --url=http://localhost:8080 solacebroker_msg_vpn.default default messageVpn.tf | ||
cat messageVpn.tf | ||
- name: Test generated terraform on broker | ||
run: | | ||
# Create | ||
sed -i '/# username = "admin"/c\username = "admin"' messageVpn.tf | ||
sed -i '/# password = "admin"/c\password = "admin"' messageVpn.tf | ||
terraform plan | ||
terraform apply -auto-approve | ||
sleep 1 | ||
- name: Create custom messageVPN with 21 messageVpn queues (Paging Test) | ||
run: | | ||
pushd ci/broker_vpn_q3 | ||
# Create | ||
terraform plan | ||
terraform apply -auto-approve | ||
sleep 1 | ||
popd | ||
- name: Confirm all 21 queues are present with paging (Paging Test) | ||
run: | | ||
SOLACEBROKER_REGISTRY_OVERRIDE=registry.terraform.io/solaceproducts/solacebroker SOLACEBROKER_USERNAME=admin SOLACEBROKER_PASSWORD=admin terraform-provider-solacebroker generate --url=http://localhost:8080 solacebroker_msg_vpn.qn another messageVpn.tf | ||
cat messageVpn.tf | ||
grep -o 'solacebroker_msg_vpn_queue ' messageVpn.tf | wc -l | grep 21 | ||
- name: Create custom messageVPN with large config | ||
run: | | ||
pushd ci/broker_vpn_test | ||
# Create | ||
terraform plan | ||
terraform apply -auto-approve | ||
sleep 1 | ||
popd | ||
- name: Generate complete large config file for custom messageVPN file | ||
run: | | ||
SOLACEBROKER_REGISTRY_OVERRIDE=registry.terraform.io/solaceproducts/solacebroker SOLACEBROKER_USERNAME=admin SOLACEBROKER_PASSWORD=admin terraform-provider-solacebroker generate --url=http://localhost:8080 solacebroker_msg_vpn.test test messageVpn.tf | ||
cat messageVpn.tf | ||
- name: Generate some resources( only msg_vpn_queue) for custom messageVPN file | ||
run: | | ||
SOLACEBROKER_REGISTRY_OVERRIDE=registry.terraform.io/solaceproducts/solacebroker SOLACEBROKER_USERNAME=admin SOLACEBROKER_PASSWORD=admin terraform-provider-solacebroker generate --url=http://localhost:8080 solacebroker_msg_vpn_queue.q test/test messageVpn.tf | ||
cat messageVpn.tf |
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 |
---|---|---|
@@ -0,0 +1,108 @@ | ||
name: Build Terraform Provider | ||
|
||
on: | ||
push: | ||
|
||
jobs: | ||
build: | ||
name: Build & test Terraform provider | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: "1.20" | ||
|
||
- name: Check out code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Terraform latest | ||
uses: hashicorp/setup-terraform@v2 | ||
with: | ||
terraform_wrapper: false | ||
|
||
- name: Checkout generator | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: SolaceDev/broker-terraform-provider-generator | ||
token: ${{ secrets.GH_PAT }} # `GH_PAT` is a secret that contains your PAT | ||
path: broker-terraform-provider-generator | ||
ref: "v0.1.0" | ||
|
||
- name: Build and install generator | ||
run: | | ||
pushd broker-terraform-provider-generator | ||
go mod tidy | ||
go install . | ||
ls ~/go/bin | ||
popd | ||
- name: Generate provider code | ||
run: | | ||
SWAGGER_SPEC_NAME=`ls ci/swagger_spec` | ||
echo "Generating code using spec $SWAGGER_SPEC_NAME" | ||
BASE=`pwd` | ||
pushd internal/broker/generated | ||
rm ./* | ||
SEMP_V2_SWAGGER_CONFIG_EXTENDED_JSON="$BASE/ci/swagger_spec/$SWAGGER_SPEC_NAME" ~/go/bin/broker-terraform-provider-generator all | ||
popd | ||
- name: Test Provider and generate documentations | ||
run: | | ||
make test-coverage | ||
make generate-docs | ||
- name: Build provider | ||
run: | | ||
go mod tidy | ||
go install . | ||
~/go/bin/terraform-provider-solacebroker version | ||
~/go/bin/terraform-provider-solacebroker help | ||
- name: Check changed files | ||
uses: tj-actions/verify-changed-files@v14 | ||
id: check-changed-files | ||
with: | ||
files: | | ||
internal/broker/generated | ||
docs | ||
- name: Run step only when any of the above files change. | ||
if: steps.check-changed-files.outputs.files_changed == 'true' | ||
run: | | ||
echo "Changed files: ${{ steps.check-changed-files.outputs.changed_files }}" | ||
# - name: Commit back any updated source code | ||
# if: steps.check-changed-files.outputs.files_changed == 'true' | ||
# uses: EndBug/add-and-commit@v9 | ||
# with: | ||
# committer_name: GitHub Actions | ||
# committer_email: [email protected] | ||
# message: 'Updating generated source [skip ci]' | ||
# add: 'internal/broker/generated/*.go' | ||
# new_branch: GeneratedSourceUpdates-${{ github.ref_name }} | ||
|
||
# - name: Create pull request | ||
# if: steps.check-changed-files.outputs.files_changed == 'true' | ||
# run: | | ||
# CURRENT_BRANCH=${GITHUB_REF_NAME} | ||
# gh pr create -B ${CURRENT_BRANCH} -H "GeneratedSourceUpdates-${CURRENT_BRANCH}" --title "Merge generated source updates into ${CURRENT_BRANCH}" --body 'Created by Github action' | ||
# env: | ||
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
|
||
Plugin-Integration-Test: | ||
needs: build | ||
uses: ./.github/workflows/provider-build-pipeline.yml | ||
secrets: inherit | ||
|
||
Plugin-Acceptance-Test: | ||
needs: build | ||
uses: ./.github/workflows/provider-acceptance-test.yml | ||
secrets: inherit | ||
|
||
CLI-Integration-Test: | ||
needs: build | ||
uses: ./.github/workflows/cli-build-pipeline.yml | ||
secrets: inherit |
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: Provider Acceptance Test | ||
|
||
on: workflow_call | ||
|
||
|
||
jobs: | ||
test: | ||
name: Run formal acceptance test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: "1.20" | ||
|
||
- name: Check out code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Acceptance test | ||
run: | | ||
make testacc |
Oops, something went wrong.