Skip to content

Commit

Permalink
GA release 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
bczoma authored Jun 28, 2024
1 parent cf1cd0f commit e64cca2
Show file tree
Hide file tree
Showing 30 changed files with 68,988 additions and 3 deletions.
123 changes: 123 additions & 0 deletions .github/workflows/module-test-pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
name: Provider Test Pipeline

on: push

jobs:
test:
name: Run Provider setup and tests
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4

- name: Set up Terraform latest - with token
uses: hashicorp/setup-terraform@v3
with:
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}
terraform_wrapper: true

- 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 --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: Setup if private provider is required
# run: |
# export PRIVATE_PROVIDER_VERSION="1.0.0-rc.7"
# if [ -n "$PRIVATE_PROVIDER_VERSION" ]; then
# echo "Using private provider version $PRIVATE_PROVIDER_VERSION"
# grep -rl 'source = "' . | xargs sed -i 's@source = ".*$@source = "app.terraform.io/SolaceDev/solacebroker"@g'
# grep -rl 'version = "' . | xargs sed -i "s@ version = \".*\$@ version = \"${PRIVATE_PROVIDER_VERSION}\"@g"
# fi

- name: Test module from template on test broker
run: |
ci/scripts/test-module.sh ci/template-test
- name: Test module root on test broker
run: |
ci/scripts/test-module.sh ci/module-test
- name: Test examples
run: |
for dir in examples/*; do (ci/scripts/test-module.sh "$dir"); done
# ci/scripts/test-module.sh examples/non-exclusive-queue
- name: Discard any changes in checked out code
run: |
git checkout -- .
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: "1.22"

- 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 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"
rm ./*.tf
SEMP_V2_SWAGGER_CONFIG_EXTENDED_JSON="ci/swagger_spec/$SWAGGER_SPEC_NAME" MODULE_TEMPLATE_FOLDER="internal/gen-template" ~/go/bin/broker-terraform-code-generator software-module
- name: Add copyright headers where needed
run: |
go install github.com/google/addlicense@latest
addlicense -c 'Solace Corporation. All rights reserved.' -v -l apache ./*.tf
addlicense -c 'Solace Corporation. All rights reserved.' -v -l apache $(find ./examples -name "*.tf" -type f -print0 | xargs -0)
- name: Ensure version reflects release candidate version
run: |
# only if ${GITHUB_REF_NAME} starts with 'v' or 'dev' and followed by a semver
if [[ $GITHUB_REF_NAME =~ ^(v|dev)[0-9]+\.[0-9]+\.[0-9]+.*$ ]]; then
VERSION=$(echo "${GITHUB_REF_NAME}" | cut -d'v' -f2)
echo $VERSION > VERSION
fi
- name: Check changed files
uses: tj-actions/verify-changed-files@v17
id: check-changed-files
with:
files: |
!broker-terraform-code-generator
- 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'
add: ". ':!broker-terraform-code-generator'"
new_branch: GeneratedSourceUpdates-${{ github.ref_name }}

- name: Create pull request
if: steps.check-changed-files.outputs.files_changed == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
CURRENT_BRANCH=${GITHUB_REF_NAME}
gh pr create -B ${CURRENT_BRANCH} -H "GeneratedSourceUpdates-${CURRENT_BRANCH}" --title "Merge updates into ${CURRENT_BRANCH}" --body 'Created by Github action'
echo Review and approve PR before push can continue
exit 1 // force actions stop here
121 changes: 121 additions & 0 deletions .github/workflows/prep-internal-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# Launched manually
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.2'


jobs:
build:
name: Prep release
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: "1.22"

- name: Checkout the code
uses: actions/checkout@v2

- name: Check release version and set next version
run: |
if ! echo "${{ github.event.inputs.release_branch_name }}" | grep ^v ; then
echo "Incorrect release branch name ${{ github.event.inputs.release_branch_name }}, must start with 'v'" ; exit 1
fi
if echo "${{ github.ref_name }}" | grep ^dev ; then
# set next dev version GH env, otherwise set it empty
echo "NEXT_DEV_VERSION=$(echo ${{ github.ref_name }} | awk -F. -v OFS=. '{$NF += 1 ; print}')" >> $GITHUB_ENV
fi
- name: Code format, dependencies, checks
run: |
find . -type d -print0 | xargs -0 -n1 terraform fmt
- 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 --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: Check code builds and pass acceptance test
# run: |
# ci/scripts/test-module.sh ci/module-test
# for dir in examples/*; do (ci/scripts/test-module.sh "$dir"); done

- name: Ensure version reflects release candidate version
run: |
VERSION=$(echo "${{ github.event.inputs.release_branch_name }}" | cut -d'v' -f2)
echo $VERSION > VERSION
- name: Add copyright headers where needed
run: |
go install github.com/google/addlicense@latest
addlicense -c 'Solace Corporation. All rights reserved.' -v -l apache ./*.tf
addlicense -c 'Solace Corporation. All rights reserved.' -v -l apache $(find ./examples -name "*.tf" -type f -print0 | xargs -0)
- name: Check changed files
uses: tj-actions/verify-changed-files@v17
id: check-changed-files

- name: Run step only when any of the 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 updates when any of the files change
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 release candidate [skip ci]'
new_branch: GeneratedSourceUpdates-${{ github.ref_name }}

- name: Create pull request if needed, then break here because manual approval of the changes is required
if: steps.check-changed-files.outputs.files_changed == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
CURRENT_BRANCH=${GITHUB_REF_NAME}
gh pr create -B ${CURRENT_BRANCH} -H "GeneratedSourceUpdates-${CURRENT_BRANCH}" --title "Merge generated source updates into release candidate ${CURRENT_BRANCH}" --body 'Created by Github action'
echo Review and approve PR before release can continue
exit 1 // force actions stop here
- name: Create release branch starting point
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
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 PR to release branch
# uses: peterjgrainger/[email protected]
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# branch: "${{ github.event.inputs.release_branch_name }}"

# - name: Tag the release branch
# if: env.NEXT_DEV_VERSION != ''
# uses: peterjgrainger/[email protected]
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# branch: ${{ env.NEXT_DEV_VERSION }}

58 changes: 58 additions & 0 deletions .github/workflows/verify-registry-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Launched manually to test new release from registry
on:
workflow_dispatch:
inputs:
release_version:
description: 'The version of the release in the Terraform registry (expecting semver format)'
required: true
default: '0.1.0-rc.1'
public_release:
type: boolean
description: 'Check if this is a public release (from registry.terraform.io). Private release is from app.terraform.io'
required: true
default: false

jobs:
build:
name: Verify registry release
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: "1.22"

- name: Check out code
uses: actions/checkout@v4

- 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 --env system_scaling_maxkafkabridgecount="10" --name=solace \
--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: Set up Terraform latest - public
if: ${{ github.event.inputs.public_release != 'false' }}
uses: hashicorp/setup-terraform@v3
with:
terraform_wrapper: true

- name: Set up Terraform latest - private, with token
if: ${{ github.event.inputs.public_release == 'false' }}
uses: hashicorp/setup-terraform@v3
with:
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}
terraform_wrapper: true

- name: Setup token and patch module with release information
run: |
if [ "${{ github.event.inputs.public_release }}" == "false" ] ; then
echo Internal release
MODULE_REF="app.terraform.io/SolaceDev/jndi/solacebroker"
else
echo Public release
MODULE_REF="SolaceProducts/jndi/solacebroker"
fi
ci/scripts/test-module.sh ci/module-test/ $MODULE_REF "${{ github.event.inputs.release_version }}"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# .tfstate files
*.tfstate
*.tfstate.*
*.hcl

# Crash log files
crash.log
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]
Copyright 2024 Solace Corporation

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
76 changes: 74 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,74 @@
# terraform-solacebroker-jndi
Solace software broker Terraform module to abstract jndi configuration
# Solace PubSub+ Software Event Broker JNDI Terraform Module

This Terraform module configures a [connection factory object](https://docs.solace.com/API/Solace-JMS-API/Connection-Factories.htm) in the JNDI store of a [Solace PubSub+ Event Broker](https://solace.com/products/event-broker/).

Use case details are provided in the [Examples](#examples) section.

## Related modules

To use JNDI, access must be enabled on the Message VPN. You can configure this using the [Service Module](https://registry.terraform.io/modules/SolaceProducts/service/solacebroker/latest). By default, JNDI access is not enabled on Solace PubSub+ appliances, but it is enabled on Solace PubSub+ software event brokers.

To configure JNDI managed objects (JNDI Topics and Queues) when provisioning a PubSub+ queue or topic endpoint, use the [Queues & Endpoints Module](https://registry.terraform.io/modules/SolaceProducts/queue-endpoint/solacebroker/latest).

## Module input variables

### Required

* `msg_vpn_name` - the Message VPN on the event broker for which JNDI configuration is created.
* `connection_factory_name` - The name of the connection factory to be created.

### Optional

* `local_transactions_enabled` - Specifies if the connection factory shall support local transactions. The default is `false`.
* `xa_enabled` - Specifies if the connection factory shall support XA transactions. When enabled it also enables local transactions support. The default is `false`. Note: this variable has the same name and use as the underlying resource attribute.

Additional optional module variables names are the same as the underlying connection factory resource attributes. To determine the variable name mappings, we recommend that you look for matching attribute names in the documentation for the resource:

| Resource name |
|---------------|
|[solacebroker_msg_vpn_jndi_connection_factory](https://registry.terraform.io/providers/SolaceProducts/solacebroker/latest/docs/resources/msg_vpn_jndi_connection_factory#optional)|

The default value for most of the optional variables is `null`, meaning that if you don’t provide a value then the default value of the resource is provisioned on the event broker.

## Module outputs

[Module outputs](https://developer.hashicorp.com/terraform/language/values/outputs) provide reference to created resources. Any reference to a resource that has not been created will be set to `(null)`.

Outputs:
* `connection_factory` - The connection factory created.
* `xa_connection_factory` - An alternative reference to the same `connection_factory`, only if an XA connection factory has been created.

## Providers

| Name | Version |
|------|---------|
| <a name="provider_solacebroker"></a> [solacebroker](https://registry.terraform.io/providers/SolaceProducts/solacebroker/latest) | ~> 1.0 |

## Resources

The following table shows the resources created.

| Name |
|------|
| solacebroker_msg_vpn_jndi_connection_factory |

## Examples

The following examples demonstrate several specific use cases for this module:

- [Basic connection factory](examples/basic/)
- [Connection factory with local transactions support](examples/local-transactions-support/)
- [Connection factory with XA transactions support](examples/xa-transactions-support/)

## Module use recommendations

This module is expected to be used primarily by application teams. It supports provisioning connection factories required by a specific application. It may be forked and adjusted with private defaults.

## Resources

For more information about Solace technology in general please visit these resources:

- Solace [Technical Documentation](https://docs.solace.com/)
- The Solace Developer Portal website at: [solace.dev](//solace.dev/)
- Understanding [Solace technology](//solace.com/products/platform/)
- Ask the [Solace community](//dev.solace.com/community/).
Loading

0 comments on commit e64cca2

Please sign in to comment.