Skip to content

Commit

Permalink
GA release 1.0.0 (#24)
Browse files Browse the repository at this point in the history
* Initial sync to sw provider 1.0.0
* Updating generated sources and documentation
* Updating generated sources from broker 10.8.1 defaults
* Acceptance test to use lower default that works on the simulated broker
* Ported documentation from sw broker latest
* Fix broker fail if all creds are provided in env (ported from sw provider)
  • Loading branch information
bczoma authored Jul 10, 2024
1 parent 5fa1c94 commit c0f2dac
Show file tree
Hide file tree
Showing 279 changed files with 6,204 additions and 4,695 deletions.
35 changes: 21 additions & 14 deletions .github/workflows/cli-test-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: "1.21"
go-version: "1.22"

- name: Check out code
uses: actions/checkout@v4
Expand All @@ -22,7 +22,7 @@ jobs:
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 \
--mount type=bind,source=$HOME/solace,destination=/var/lib/solace,ro=false solace/solace-pubsub-standard:"10.6.1.52"
--mount type=bind,source=$HOME/solace,destination=/var/lib/solace,ro=false solace/solace-pubsub-standard:"10.8.1.126"
while ! curl -s localhost:8080 | grep aurelia ; do sleep 1 ; done
- name: Use local provider
Expand All @@ -37,7 +37,7 @@ jobs:
- name: Build provider
run: |
make dep
make test-coverage
make install
ls ~/go/bin
terraform-provider-solacebrokerappliance -h
Expand Down Expand Up @@ -78,10 +78,14 @@ jobs:
fi
exit 1
- name: Generate sample Terraform for message vpn client
- name: Failure to Generate sample Terraform due to invalid provider specific identifiers2
run: |
SOLACEBROKER_REGISTRY_OVERRIDE=registry.terraform.io/solaceproducts/solacebrokerappliance SOLACEBROKER_USERNAME=admin SOLACEBROKER_PASSWORD=admin SOLACEBROKER_SKIP_API_CHECK=true terraform-provider-solacebrokerappliance generate --url=http://localhost:8080 solacebroker_msg_vpn_rest_delivery_point.my-rdp default messageVpn.tf
cat messageVpn.tf
SOLACEBROKER_REGISTRY_OVERRIDE=registry.terraform.io/solaceproducts/solacebrokerappliance SOLACEBROKER_USERNAME=admin SOLACEBROKER_PASSWORD=admin SOLACEBROKER_SKIP_API_CHECK=true terraform-provider-solacebrokerappliance generate --url=http://localhost:8080 solacebroker_msg_vpn_rest_delivery_point.my-rdp default messageVpn.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
run: |
Expand All @@ -91,13 +95,11 @@ jobs:
- name: Test generated terraform on broker
run: |
# Create
sed -i '/# username = "admin"/c\username = "admin"' messageVpn.tf
sed -i '/# password = "admin"/c\password = "admin"\n skip_api_check = true' messageVpn.tf
terraform plan
terraform apply -auto-approve
TF_VAR_broker_url=http://localhost:8080 TF_VAR_broker_username=admin TF_VAR_broker_password=admin SOLACEBROKER_SKIP_API_CHECK=true terraform plan
TF_VAR_broker_url=http://localhost:8080 TF_VAR_broker_username=admin TF_VAR_broker_password=admin SOLACEBROKER_SKIP_API_CHECK=true terraform apply -auto-approve
sleep 1
- name: Create custom messageVPN with 21 messageVpn queues (Paging Test)
- name: Create custom messageVPN with 22 messageVpn queues (Paging Test)
run: |
pushd ci/broker_vpn_q3
# Create
Expand All @@ -106,11 +108,16 @@ jobs:
sleep 1
popd
- name: Confirm all 21 queues are present with paging (Paging Test)
- name: Confirm all 22 queues are present with paging (Paging Test)
run: |
SOLACEBROKER_REGISTRY_OVERRIDE=registry.terraform.io/solaceproducts/solacebrokerappliance SOLACEBROKER_USERNAME=admin SOLACEBROKER_PASSWORD=admin SOLACEBROKER_SKIP_API_CHECK=true terraform-provider-solacebrokerappliance 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
grep -o 'solacebroker_msg_vpn_queue" ' messageVpn.tf | wc -l | grep 22
- name: Test escape characters in resources
run: |
SOLACEBROKER_REGISTRY_OVERRIDE=registry.terraform.io/solaceproducts/solacebrokerappliance SOLACEBROKER_USERNAME=admin SOLACEBROKER_PASSWORD=admin SOLACEBROKER_SKIP_API_CHECK=true terraform-provider-solacebrokerappliance generate --url=http://localhost:8080 solacebroker_msg_vpn_queue_subscription.test another/aperfectly%2F%24%2Fvalid%2F%24topic%2F%24%24/foo%2Fbarr messageVpn.tf
cat messageVpn.tf
- name: Create custom messageVPN with large config
run: |
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/core-pipeline-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: "1.21"
go-version: "1.22"

- name: Check out code
uses: actions/checkout@v4
Expand All @@ -28,14 +28,14 @@ jobs:
- name: Checkout generator
uses: actions/checkout@v4
with:
repository: SolaceDev/broker-terraform-provider-generator
repository: SolaceDev/broker-terraform-code-generator
token: ${{ secrets.GH_PAT }} # `GH_PAT` is a secret that contains your PAT
path: broker-terraform-provider-generator
ref: "v0.2.0"
path: broker-terraform-code-generator
ref: "main"

- name: Build and install generator
run: |
pushd broker-terraform-provider-generator
pushd broker-terraform-code-generator
go mod tidy
go install .
ls ~/go/bin
Expand All @@ -48,7 +48,7 @@ jobs:
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
SEMP_V2_SWAGGER_CONFIG_EXTENDED_JSON="$BASE/ci/swagger_spec/$SWAGGER_SPEC_NAME" ~/go/bin/broker-terraform-code-generator appliance-provider all
popd
- name: Build provider
Expand Down Expand Up @@ -76,7 +76,7 @@ jobs:
id: check-changed-files
with:
files: |
!broker-terraform-provider-generator
!broker-terraform-code-generator
- name: Run step only when any of the above files change.
if: steps.check-changed-files.outputs.files_changed == 'true'
Expand All @@ -90,7 +90,7 @@ jobs:
committer_name: GitHub Actions
committer_email: [email protected]
message: 'Updating generated source'
add: ". ':!broker-terraform-provider-generator'"
add: ". ':!broker-terraform-code-generator'"
new_branch: GeneratedSourceUpdates-${{ github.ref_name }}

- name: Create pull request
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/core-pipeline-main-branch-only.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: "1.21"
go-version: "1.22"

- name: Check out code
uses: actions/checkout@v4
Expand Down
83 changes: 25 additions & 58 deletions .github/workflows/prep-internal-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: "1.21"
go-version: "1.22"

- name: Checkout the code
uses: actions/checkout@v2
Expand All @@ -31,36 +31,6 @@ jobs:
echo "NEXT_DEV_VERSION=$(echo ${{ github.ref_name }} | awk -F. -v OFS=. '{$NF += 1 ; print}')" >> $GITHUB_ENV
fi
- name: Checkout generator
uses: actions/checkout@v4
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.2.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: Remove generator source
run: |
rm -rf broker-terraform-provider-generator
- name: Code format, dependencies, checks
run: |
make fmt
Expand Down Expand Up @@ -115,15 +85,12 @@ jobs:
sed -i "s/productName=.*$/productName=${{ github.event.repository.name }}/g" ci/whitesource/whitesource-agent.config
sed -i "s/projectName=.*$/projectName=${{ github.event.repository.name }}/g" ci/whitesource/whitesource-agent.config
cat ci/whitesource/whitesource-agent.config | grep productVersion
- name: Run Whitesource Action to update licenses
uses: SolaceDev/[email protected]
with:
wssURL: https://saas.whitesourcesoftware.com/agent
apiKey: ${{ secrets.WSS_API_KEY }}
productName: ${{ github.event.repository.name }}
projectName: ${{ github.event.repository.name }}
configFile: 'ci/whitesource/whitesource-agent.config'
curl https://unified-agent.s3.amazonaws.com/wss-unified-agent.jar --output ci/whitesource/wss-unified-agent.jar
export WS_APIKEY="${{ secrets.WSS_API_KEY }}"
export WS_WSS_URL="https://saas.whitesourcesoftware.com/agent"
export WS_PRODUCTNAME="${{ github.event.repository.name }}"
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]
Expand All @@ -140,20 +107,20 @@ jobs:
# with:
# branch: ${{ env.NEXT_DEV_VERSION }}

- name: Create next dev branch
if: env.NEXT_DEV_VERSION != ''
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git checkout -b ${{ env.NEXT_DEV_VERSION }}
VERSION=$(echo "${{ env.NEXT_DEV_VERSION }}" | cut -d'v' -f2)
sed -i "s/version =.*$/version = \"${VERSION}\"/g" version.go
git commit -a -m "Uprev'd version to ${VERSION}"
git push --set-upstream origin ${{ env.NEXT_DEV_VERSION }}
- name: Delete last dev branch
if: env.NEXT_DEV_VERSION != ''
uses: dawidd6/action-delete-branch@v3
with:
github_token: ${{github.token}}
branches: "${{ github.ref_name }}"
# - name: Create next dev branch
# if: env.NEXT_DEV_VERSION != ''
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: |
# git checkout -b ${{ env.NEXT_DEV_VERSION }}
# VERSION=$(echo "${{ env.NEXT_DEV_VERSION }}" | cut -d'v' -f2)
# sed -i "s/version =.*$/version = \"${VERSION}\"/g" version.go
# git commit -a -m "Uprev'd version to ${VERSION}"
# git push --set-upstream origin ${{ env.NEXT_DEV_VERSION }}

# - name: Delete last dev branch
# if: env.NEXT_DEV_VERSION != ''
# uses: dawidd6/action-delete-branch@v3
# with:
# github_token: ${{github.token}}
# branches: "${{ github.ref_name }}"
4 changes: 2 additions & 2 deletions .github/workflows/provider-acceptance-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: "1.21"
go-version: "1.22"

- name: Check out code
uses: actions/checkout@v4
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/provider-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ jobs:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 # v5.0.0
uses: goreleaser/goreleaser-action@v6
with:
version: '~> v1'
args: release --clean
env:
# GitHub sets the GITHUB_TOKEN secret automatically.
Expand Down
55 changes: 50 additions & 5 deletions .github/workflows/provider-test-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: "1.21"
go-version: "1.22"

- name: Check out code
uses: actions/checkout@v4
Expand All @@ -22,7 +22,7 @@ jobs:
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:"10.6.1.52"
--env system_scaling_maxconnectioncount="1000" --mount type=bind,source=$HOME/solace,destination=/var/lib/solace,ro=false solace/solace-pubsub-standard:"10.8.1.126"
while ! curl -s localhost:8080 | grep aurelia ; do sleep 1 ; done
- name: Use local provider
Expand All @@ -46,7 +46,6 @@ jobs:
pushd ci/broker_vpn_q
terraform plan
popd
- name: Test provider on test broker
run: |
Expand All @@ -69,10 +68,56 @@ jobs:
rm terraform.tfstate*
terraform import solacebroker_msg_vpn.newone new
popd
# larger config
- name: Test provider params from env
run: |
pushd ci/broker_vpn_test2
SOLACEBROKER_USERNAME=admin SOLACEBROKER_PASSWORD=admin SOLACEBROKER_SKIP_API_CHECK=true terraform apply -auto-approve
SOLACEBROKER_BEARER_TOKEN=abc SOLACEBROKER_SKIP_API_CHECK=true terraform apply -auto-approve | grep 401
popd
# This test requires an appliance as software broker does not have the same defaults
# - name: Test broker object attributes override
# run: |
# pushd ci/brokertest
# terraform apply -auto-approve
# terraform plan | grep "No changes"
# popd

- name: Test larger config
run: |
pushd ci/bigtest
terraform plan
terraform apply -auto-approve
terraform plan
terraform destroy -auto-approve
popd
- name: Test unknown provider param, proving that the solace provider can tolerate unknown provider params until later when it is defined
run: |
pushd ci/provider_dependency
terraform init # sets up the random provider, which will be used to generate a random password (which will be used but login will fail)
bash -c "terraform apply -auto-approve &> results.out" || echo "Expecting terraform apply to fail"
cat results.out | grep "401 Unauthorized"
popd
- name: Test state upgrade
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
Loading

0 comments on commit c0f2dac

Please sign in to comment.