Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates for Beta release #53

Merged
merged 75 commits into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
4e73699
prototype
mbartel-sol Feb 15, 2023
429a548
updated prototype version
mbartel-sol Feb 16, 2023
d5f944f
updated generation (camelCase names are now snake_case in documentation)
mbartel-sol Feb 22, 2023
1ed32b1
updated dependencies and updated as appropriate for breaking changes …
mbartel-sol Feb 24, 2023
58463f1
add support for request timeout configuration
mbartel-sol Feb 27, 2023
781d81a
generated documentation update
mbartel-sol Feb 27, 2023
af177b0
Enabled debugging for Windows
bczoma May 26, 2023
cd66a41
Added initial e2e test with creating PR for updated source code
bczoma May 26, 2023
a11e909
GH variable name fix
bczoma May 26, 2023
e5d696b
Variable updates
bczoma Jun 5, 2023
a51be02
Env var name update
bczoma Jun 5, 2023
f26b4fc
Env test
bczoma Jun 5, 2023
6ae1763
Updating generated source [skip ci]
bczoma Jun 5, 2023
b3ea6f3
Merge pull request #1 from SolaceDev/GeneratedSourceUpdates-broker-10…
bczoma Jun 5, 2023
ab93a81
Added condition to create PR
bczoma Jun 5, 2023
94ed36f
Updated swagger spec to 10.4.1.40
bczoma Jun 5, 2023
2ebc18b
Updating generated source matching API 10.4.1.40
github-actions[bot] Jun 6, 2023
9eb48d0
Updated SEMP API version
bczoma Jun 6, 2023
b19e859
Updates to propagate context to lower lever APIs where possible (#4)
bczoma Jun 26, 2023
30f2dc7
Check auto shutdown enabled (#7)
bczoma Jun 28, 2023
e666e74
objectType was not propagated (#3) (#8)
bczoma Jun 28, 2023
d31d482
SOL-94998 | pull version base path (#5)
LewisKSaint Jul 5, 2023
553adfb
Update buildtest.yml with using 1.0.0 branch of the generator
bczoma Jul 5, 2023
b0ccd1f
Bearer token, request_timeout_duration and request_min_interval suppo…
bczoma Jul 6, 2023
7c1387b
Logging and diagnostics, cleanup and library updates, regenerated doc…
bczoma Jul 11, 2023
b19dfd7
Starting point for State Upgrade support (#12)
bczoma Jul 11, 2023
acc0dd4
SOL-74881 Terraform generator (#14)
LewisKSaint Aug 23, 2023
7444646
objectType was not propagated (#3)
mbartel-sol Jun 8, 2023
81c43ad
CRE-1113/terraform-artifact-build (#13)
bczoma Aug 24, 2023
40cdf47
Fixed bug that did not generate for child resources (#17)
LewisKSaint Aug 25, 2023
67838f1
SOL-95021 | Documentation for generator (#18)
LewisKSaint Aug 25, 2023
472b94a
Acceptance tests including id, import improvements, support for versi…
bczoma Aug 30, 2023
fceb5ed
Re-generated documentation (#20)
bczoma Aug 31, 2023
a3b19d6
Added draft documentation (#21)
bczoma Sep 1, 2023
1155314
Removed deprecated objects and attributes (#22)
bczoma Sep 1, 2023
a9e832d
Regenerated docs after removal of deprecated objects and attributes
bczoma Sep 1, 2023
2afdd73
Added content to local README
bczoma Sep 1, 2023
30bb78b
Adjustments in README
bczoma Sep 1, 2023
f553d81
Merge pull request #24 from SolaceDev/ReadmeUpdates
LewisKSaint Sep 5, 2023
68e08f9
Updated version to 0.5.1
bczoma Sep 15, 2023
16e07c0
SOL-102963 SOL-102872 SOL-102099 SOL-101537 SOL-103267 | Bug fixes (#25)
LewisKSaint Sep 15, 2023
7617cbb
Releasing v0.5.2 (#29)
bczoma Sep 21, 2023
f43fe43
Uprev to v0.5.3
bczoma Sep 22, 2023
5d90e7a
Fix for crash when resource has non-identifying read-only attribute (…
bczoma Sep 22, 2023
bffe904
Uprev to v0.5.4
bczoma Sep 22, 2023
81a6d49
Bug fixes and improvement to generator to use name of resources (#31)
LewisKSaint Sep 25, 2023
7fbc842
Uprev'd version to 0.5.5
bczoma Sep 25, 2023
69aecf6
Wrapped the Not Found error so details are visible in Terraform error…
bczoma Sep 26, 2023
936ccf0
Doc Updates (#34)
bczoma Sep 27, 2023
853c968
Bug fix for parsing json string and name collision (#33)
LewisKSaint Sep 27, 2023
af90f41
Uprev'd version to 0.5.6
bczoma Sep 27, 2023
2928de8
Fix for parsing json string and name collision (#35)
LewisKSaint Sep 27, 2023
84b143d
Review beta documentation (#36)
mbartel-sol Sep 27, 2023
9e049bb
Applying the doc changes to the templates
bczoma Sep 27, 2023
d11d0a8
Count fix for occurrence (#37)
LewisKSaint Sep 27, 2023
05935dc
Bad request check for generator (#38)
LewisKSaint Sep 28, 2023
e683f15
Uprev'd to v0.5.7
bczoma Sep 28, 2023
d6d3cab
Workaround to address forever id updates in terraform plan (#39)
bczoma Sep 28, 2023
41f342f
Acceptance test with test containers (#40)
bczoma Sep 28, 2023
1920d94
fix for comma separated params for semp calls (#41)
LewisKSaint Sep 28, 2023
95aa97c
fix for count deduplication (#42)
LewisKSaint Sep 28, 2023
855aa07
Use url templating (#43)
LewisKSaint Sep 28, 2023
85a8502
Uprev'd to version 0.5.8
bczoma Sep 28, 2023
ad8611f
Replace hardcoded name of inter-object dependencies by reference (#46)
bczoma Oct 2, 2023
9ac3d5f
Cleanup generator provider output (#45)
LewisKSaint Oct 2, 2023
008f905
Added workaround: not ignoring default for `msg_vpn` attribute `authe…
bczoma Oct 2, 2023
4af7a13
Add CI for release to public terraform registry (#44)
AmanRiat1 Oct 3, 2023
48ee11f
Uprev'd version to 0.5.9
bczoma Oct 3, 2023
319f260
Removed acceptance tests from generated (#48)
bczoma Oct 3, 2023
4477fc0
Refactored unit tests (#49)
LewisKSaint Oct 4, 2023
39ce22a
Doc updates (#50)
bczoma Oct 4, 2023
aeaa96f
Additional doc updates from QA review (#51)
bczoma Oct 4, 2023
2efdfd3
SOL-104922 | Bug fix to keep indetifier name consistent with HCL (#52)
LewisKSaint Oct 5, 2023
a2bfeb3
Updated description with the correct terraform destroy command
bczoma Oct 5, 2023
cc8c48b
Updated the contributing guide
bczoma Oct 5, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
158 changes: 158 additions & 0 deletions .github/workflows/cli-build-pipeline.yml
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
108 changes: 108 additions & 0 deletions .github/workflows/core-pipeline.yml
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
21 changes: 21 additions & 0 deletions .github/workflows/provider-acceptance-test.yml
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
Loading