-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Updated SEMP API schema to latest appliance 10.9.1 * Added http proxy support * Library updates * Go version update to 1.23
- Loading branch information
Showing
58 changed files
with
569 additions
and
217 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: Test Provider triggered by a broker build | ||
# Branch naming convention assumes dev branches start with "dev" then semver release name, | ||
# internal QA release candidate branches start with "v" then semver release name. | ||
# broker builds are triggered by Jenkins from a broker release branch with an example pattern of 10.9.1 | ||
|
||
on: | ||
push: | ||
branches-ignore: | ||
- dev* | ||
- v* | ||
- main | ||
|
||
jobs: | ||
build: | ||
name: Build & test provider from broker build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: "1.23" | ||
|
||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Checkout generator | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: SolaceDev/broker-terraform-code-generator | ||
token: ${{ secrets.GH_PAT }} # `GH_PAT` is a secret that contains your PAT | ||
path: broker-terraform-code-generator | ||
ref: "main" | ||
|
||
- name: Build and install generator | ||
run: | | ||
pushd broker-terraform-code-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-code-generator appliance-provider all | ||
popd | ||
- name: Check changed files | ||
uses: tj-actions/verify-changed-files@v20 | ||
id: check-changed-files | ||
with: | ||
files: | | ||
!broker-terraform-code-generator | ||
!version.go | ||
- name: Run step only when no change detected | ||
if: steps.check-changed-files.outputs.files_changed == 'false' | ||
run: | | ||
echo "No changes detected, skipping further steps" | ||
- name: List changed files - from now on all tests are run only if there were changes | ||
if: steps.check-changed-files.outputs.files_changed == 'true' | ||
run: | | ||
echo "Changed files: ${{ steps.check-changed-files.outputs.changed_files }}" | ||
echo ******** Excluding MarkdownDescription: | ||
git diff -I MarkdownDescription | ||
echo ******** Including MarkdownDescription: | ||
git diff | ||
- name: Set up Terraform latest | ||
if: steps.check-changed-files.outputs.files_changed == 'true' | ||
uses: hashicorp/setup-terraform@v2 | ||
with: | ||
terraform_wrapper: false | ||
|
||
- name: Setup Test broker | ||
if: steps.check-changed-files.outputs.files_changed == 'true' | ||
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 --env system_scaling_maxkafkabridgecount="10" --name=solace \ | ||
--env system_scaling_maxconnectioncount="1000" --mount type=bind,source=$HOME/solace,destination=/var/lib/solace,ro=false solace/solace-pubsub-standard:latest | ||
while ! curl -s localhost:8080 | grep aurelia ; do sleep 1 ; done | ||
- name: Run acceptance test | ||
if: steps.check-changed-files.outputs.files_changed == 'true' | ||
run: | | ||
make vet | ||
make testacc | ||
- name: Use local provider | ||
if: steps.check-changed-files.outputs.files_changed == 'true' | ||
run: | | ||
echo " | ||
provider_installation { | ||
dev_overrides { | ||
\"registry.terraform.io/solaceproducts/solacebrokerappliance\" = \"${HOME}/go/bin\" | ||
} | ||
direct {} | ||
}" > ~/.terraformrc | ||
- name: Build provider | ||
if: steps.check-changed-files.outputs.files_changed == 'true' | ||
run: | | ||
make test-coverage | ||
make install | ||
ls ~/go/bin | ||
terraform-provider-solacebrokerappliance -h | ||
- name: Run provider test - create custom messageVPN with large config | ||
if: steps.check-changed-files.outputs.files_changed == 'true' | ||
run: | | ||
pushd ci/broker_vpn_test | ||
# Create | ||
terraform plan | ||
terraform apply -auto-approve | ||
sleep 1 | ||
popd | ||
- name: Run generate test - generate complete large config file for custom messageVPN file | ||
if: steps.check-changed-files.outputs.files_changed == 'true' | ||
run: | | ||
SOLACEBROKER_REGISTRY_OVERRIDE=registry.terraform.io/solaceproducts/solacebroker SOLACEBROKER_USERNAME=admin SOLACEBROKER_PASSWORD=admin SOLACEBROKER_SKIP_API_CHECK=true terraform-provider-solacebrokerappliance generate --url=http://localhost:8080 solacebroker_msg_vpn.test test messageVpn.tf | ||
cat messageVpn.tf | ||
- name: Run provider test - delete large config | ||
if: steps.check-changed-files.outputs.files_changed == 'true' | ||
run: | | ||
pushd ci/broker_vpn_test | ||
terraform plan | ||
terraform destroy -auto-approve | ||
sleep 1 | ||
popd | ||
- name: Test state upgrade | ||
if: steps.check-changed-files.outputs.files_changed == 'true' | ||
run: | | ||
pushd ci/state_upgrade | ||
bash -c "terraform plan &> results.out" || echo "Expecting terraform plan to fail" | ||
cat results.out | grep "Found deprecated state key 'deprecated_att" | ||
cp terraform.tfstate terraform.tfstate.bak | ||
sed -i '/deprecated_att/d' terraform.tfstate # remove deprecated non-null attributes from state | ||
terraform plan | grep "3 to add" | ||
terraform apply -auto-approve | grep "Apply complete" | ||
# GH actions fails on following commands, need to investigate. Passes locally. | ||
# diff terraform.tfstate terraform.tfstate.bak > diff.out | ||
# ls -l | ||
# cat diff.out | ||
# grep "> \"schema_version\": 0," diff.out | wc -l | grep 3 # verify schema has been upgraded | ||
# grep "> \"deprecated1\": null," diff.out # verify deprecated has been removed | ||
# grep "> \"deprecated2\": null," diff.out # verify deprecated has been removed | ||
# grep "< \"clear_percent\": 20," diff.out # verify string has been converted to number | ||
# grep "< \"egress_enabled\": true," diff.out # verify string has been converted to bool | ||
# terraform destroy -auto-approve | ||
popd |
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,10 +2,14 @@ | |
on: | ||
workflow_dispatch: | ||
inputs: | ||
prev_branch_name: | ||
description: 'Prev branch name, must start with v' | ||
required: true | ||
default: 'v0.1.0-rc.1' | ||
release_branch_name: | ||
description: 'Release branch name, must start with v' | ||
required: true | ||
default: 'v0.1.0-rc.1' | ||
default: 'v0.1.0-rc.2' | ||
|
||
|
||
jobs: | ||
|
@@ -16,7 +20,7 @@ jobs: | |
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: "1.22" | ||
go-version: "1.23" | ||
|
||
- name: Checkout the code | ||
uses: actions/checkout@v2 | ||
|
@@ -51,7 +55,7 @@ jobs: | |
sed -i "s/version =.*$/version = \"${VERSION}\"/g" version.go | ||
- name: Check changed files | ||
uses: tj-actions/verify-changed-files@v17 | ||
uses: tj-actions/verify-changed-files@v20 | ||
id: check-changed-files | ||
|
||
- name: Run step only when any of the files change | ||
|
@@ -92,12 +96,26 @@ jobs: | |
export WS_PROJECTNAME="${{ github.event.repository.name }}" | ||
java -jar ci/whitesource/wss-unified-agent.jar -c ci/whitesource/whitesource-agent.config -d . | ||
- name: Create the release branch | ||
uses: peterjgrainger/[email protected] | ||
- name: Create release branch starting point | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
branch: "${{ github.event.inputs.release_branch_name }}" | ||
run: | | ||
git fetch | ||
git push origin refs/remotes/origin/${{ github.event.inputs.prev_branch_name }}:refs/heads/${{ github.event.inputs.release_branch_name }} | ||
- name: Create PR to release branch | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
CURRENT_BRANCH=${GITHUB_REF_NAME} | ||
gh pr create -B ${{ github.event.inputs.release_branch_name }} --title "New release ${{ github.event.inputs.release_branch_name }}" --body 'Created by Github action' | ||
# - name: Create the release branch | ||
# uses: peterjgrainger/[email protected] | ||
# env: | ||
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
# with: | ||
# branch: "${{ github.event.inputs.release_branch_name }}" | ||
|
||
# - name: Create next dev branch | ||
# if: env.NEXT_DEV_VERSION != '' | ||
|
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 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.