Skip to content

Updating generated sources from broker 10.8.1 defaults #21

Updating generated sources from broker 10.8.1 defaults

Updating generated sources from broker 10.8.1 defaults #21

name: Build Terraform Provider in Development phase
# 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.
on:
push:
branches-ignore:
- main
jobs:
build:
name: Build & test Terraform provider
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.22"
- name: Check out code
uses: actions/checkout@v4
- name: Set up Terraform latest
uses: hashicorp/setup-terraform@v2
with:
terraform_wrapper: false
- 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: Build provider
run: |
make dep
make fmt
make install
~/go/bin/terraform-provider-solacebrokerappliance version
~/go/bin/terraform-provider-solacebrokerappliance help
- name: Test Provider and generate documentations
run: |
# make testacc
make generate-docs
- name: Ensure version reflects release candidate version
run: |
if echo "${{ github.ref_name }}" | grep ^dev || echo "${{ github.ref_name }}" | grep ^v ; then
VERSION=$(echo "${{ github.ref_name }}" | cut -d'v' -f2)
sed -i "s/version =.*$/version = \"${VERSION}\"/g" version.go
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 generated source updates into ${CURRENT_BRANCH}" --body 'Created by Github action'
echo Review and approve PR before push can continue
exit 1 // force actions stop here
Plugin-Integration-Test:
needs: build
uses: ./.github/workflows/provider-test-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-test-pipeline.yml
secrets: inherit