From b146befbc4ed7e5c3004c89e4cb74127bf438692 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 5 Mar 2024 10:19:55 -0500 Subject: [PATCH] IPv6 URL fix (#7) --- .github/workflows/prep-internal-release.yml | 28 ++++++++++++++--- README.md | 1 + VERSION | 2 +- examples/basic/main.tf | 35 +++++++++++---------- internal/gen-template/main.tf | 2 +- main.tf | 6 ++-- 6 files changed, 49 insertions(+), 25 deletions(-) diff --git a/.github/workflows/prep-internal-release.yml b/.github/workflows/prep-internal-release.yml index d7bbaae..6c7b056 100644 --- a/.github/workflows/prep-internal-release.yml +++ b/.github/workflows/prep-internal-release.yml @@ -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: @@ -86,12 +90,26 @@ jobs: echo Review and approve PR before release can continue exit 1 // force actions stop here - - name: Create the release branch - uses: peterjgrainger/action-create-branch@v2.4.0 + - 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 PR to release branch + # uses: peterjgrainger/action-create-branch@v2.4.0 + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # with: + # branch: "${{ github.event.inputs.release_branch_name }}" # - name: Tag the release branch # if: env.NEXT_DEV_VERSION != '' diff --git a/README.md b/README.md index e8f0779..20b3c81 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ Important: The REST delivery point must have permission to consume messages from ### Optional +* `client_profile_name` - the [client profile associated](https://docs.solace.com/Services/Managing-RDPs.htm#associating-client-profiles-with-REST-delivery-points). If not provided, the `default` client profile for the Message VPN will be associated. * `request_headers` - A set of request headers to be added to the HTTP request * `protected_request_headers` - A set of protected request headers with sensitive value to be added to the HTTP request * `rest_consumer_name` - The name of the REST consumer to be created. The default is `consumer`. diff --git a/VERSION b/VERSION index f2e984b..0d15162 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.1.0-rc.2 +0.1.0-rc.3 diff --git a/examples/basic/main.tf b/examples/basic/main.tf index 4c2edc2..ba178be 100644 --- a/examples/basic/main.tf +++ b/examples/basic/main.tf @@ -1,17 +1,17 @@ -# Copyright 2024 Solace Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - +# Copyright 2024 Solace Corporation. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + provider "solacebroker" { username = "admin" password = "admin" @@ -50,8 +50,11 @@ module "testrdp" { msg_vpn_name = "default" rest_delivery_point_name = "basic_rdp" url = "https://example.com/test" - # queue_name = module.rdp_queue.queue.queue_name - queue_name = solacebroker_msg_vpn_queue.rdp_queue.queue_name + # queue_name = module.rdp_queue.queue.queue_name + queue_name = solacebroker_msg_vpn_queue.rdp_queue.queue_name + + # Example configuration of a client profile. Commented out here since the "default" client profile will be used if not specified + # client_profile_name = "default" } output "rdp" { diff --git a/internal/gen-template/main.tf b/internal/gen-template/main.tf index e0aae2f..571aa7b 100644 --- a/internal/gen-template/main.tf +++ b/internal/gen-template/main.tf @@ -1,7 +1,7 @@ locals { tls = startswith(lower(var.url), "https:") slashSplit = split("/", var.url) - isIpV6HostWithPort = length(split("]", local.slashSplit[2])) == 2 + isIpV6HostWithPort = length(split("]", local.slashSplit[2])) == 2 isIpV6NoPort = local.isIpV6HostWithPort ? false : length(split(":", local.slashSplit[2])) > 2 address = local.isIpV6NoPort ? join(local.slashSplit[2], ["[", "]"]) : local.slashSplit[2] hostPortSplit = local.isIpV6HostWithPort || local.isIpV6NoPort ? split("]:", trimprefix(local.address, "[")) : split(":", local.address) diff --git a/main.tf b/main.tf index f1e04b9..d05c128 100644 --- a/main.tf +++ b/main.tf @@ -15,8 +15,10 @@ locals { tls = startswith(lower(var.url), "https:") slashSplit = split("/", var.url) - isIpV6HostPort = length(split("]", local.slashSplit[2])) == 2 - hostPortSplit = local.isIpV6HostPort ? split("]:", trimprefix(local.slashSplit[2], "[")) : split(":", local.slashSplit[2]) + isIpV6HostWithPort = length(split("]", local.slashSplit[2])) == 2 + isIpV6NoPort = local.isIpV6HostWithPort ? false : length(split(":", local.slashSplit[2])) > 2 + address = local.isIpV6NoPort ? join(local.slashSplit[2], ["[", "]"]) : local.slashSplit[2] + hostPortSplit = local.isIpV6HostWithPort || local.isIpV6NoPort ? split("]:", trimprefix(local.address, "[")) : split(":", local.address) host = trimsuffix(local.hostPortSplit[0], "]") port = length(local.hostPortSplit) == 2 ? tonumber(local.hostPortSplit[1]) : (local.tls ? 443 : 80) path = "/${join("/", slice(local.slashSplit, 3, length(local.slashSplit)))}"