From d1b42ee1aaa3bb1f2f7e7b5141fb72487e54798b Mon Sep 17 00:00:00 2001 From: Rodrigo Cury Date: Thu, 27 Mar 2025 13:22:16 -0300 Subject: [PATCH 1/4] fix-beta-input --- action.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/action.yaml b/action.yaml index b4afc46..435823e 100644 --- a/action.yaml +++ b/action.yaml @@ -93,11 +93,11 @@ runs: - name: Define Domains id: stackspot-url run: | - if [ "${{ inputs.BETA_CLI_ENVIRONMENT }}" == "stg" ]; then + if [ "${{ inputs.BETA_ENVIRONMENT }}" == "stg" ]; then STACKSPOT_IAM_URL="https://iam-auth-ssr.stg.stackspot.com" STACKSPOT_RUNTIME_MANAGER_URL="https://runtime-manager.stg.stackspot.com" - elif [ "${{ inputs.BETA_CLI_ENVIRONMENT }}" == "dev" ]; then + elif [ "${{ inputs.BETA_ENVIRONMENT }}" == "dev" ]; then STACKSPOT_IAM_URL="https://iam-auth-ssr.dev.stackspot.com" STACKSPOT_RUNTIME_MANAGER_URL="https://runtime-manager.dev.stackspot.com" From da1bd57a4b67f017bab508667b0a3d3c0c02a7a4 Mon Sep 17 00:00:00 2001 From: Rodrigo Cury Date: Thu, 27 Mar 2025 13:34:51 -0300 Subject: [PATCH 2/4] fixed workspace url --- action.yaml | 6 ++++++ runtime.py | 7 ++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/action.yaml b/action.yaml index 435823e..2565800 100644 --- a/action.yaml +++ b/action.yaml @@ -96,17 +96,21 @@ runs: if [ "${{ inputs.BETA_ENVIRONMENT }}" == "stg" ]; then STACKSPOT_IAM_URL="https://iam-auth-ssr.stg.stackspot.com" STACKSPOT_RUNTIME_MANAGER_URL="https://runtime-manager.stg.stackspot.com" + STACKSPOT_WORKSPACE_URL="https://workspace-workspace-api.stg.stackspot.com" elif [ "${{ inputs.BETA_ENVIRONMENT }}" == "dev" ]; then STACKSPOT_IAM_URL="https://iam-auth-ssr.dev.stackspot.com" STACKSPOT_RUNTIME_MANAGER_URL="https://runtime-manager.dev.stackspot.com" + STACKSPOT_WORKSPACE_URL="https://workspace-workspace-api.dev.stackspot.com" else STACKSPOT_IAM_URL="https://auth.stackspot.com" STACKSPOT_RUNTIME_MANAGER_URL="https://runtime-manager.stackspot.com" + STACKSPOT_WORKSPACE_URL="https://workspace.stackspot.com" fi echo "iam=$STACKSPOT_IAM_URL" >> "$GITHUB_OUTPUT" + echo "workspace=$STACKSPOT_WORKSPACE_URL" >> "$GITHUB_OUTPUT" echo "runtime_manager=$STACKSPOT_RUNTIME_MANAGER_URL" >> "$GITHUB_OUTPUT" shell: bash @@ -126,7 +130,9 @@ runs: VERSION_TAG: ${{ inputs.VERSION_TAG }} ENVIRONMENT: ${{ inputs.ENVIRONMENT }} STACKSPOT_IAM_URL: ${{ steps.stackspot-url.outputs.iam }} + STACKSPOT_WORKSPACE_URL: ${{ steps.stackspot-url.outputs.workspace }} STACKSPOT_RUNTIME_MANAGER_URL: ${{ steps.stackspot-url.outputs.runtime_manager }} + STACKSPOT_WORKSPACE_URL run: | if [ ${{runner.os}} != 'Windows' ]; then python3 ${{ github.action_path }}/runtime.py diff --git a/runtime.py b/runtime.py index d8a68e8..ab6a0f8 100644 --- a/runtime.py +++ b/runtime.py @@ -36,8 +36,8 @@ def build_pipeline_url() -> str: return url -def get_env_id(slug, access_token): - workspace_url = "https://workspace.stackspot.com/v1/environments" +def get_env_id(slug, access_token, workspace_url): + workspace_url = f"{workspace_url}/v1/environments" deploy_headers = {"Authorization": f"Bearer {access_token}", "Content-Type": "application/json"} env_request = requests.get( url=workspace_url, @@ -72,6 +72,7 @@ def get_env_id(slug, access_token): ENVIRONMENT = os.getenv("ENVIRONMENT") STACKSPOT_IAM_URL = os.getenv("STACKSPOT_IAM_URL") STACKSPOT_RUNTIME_MANAGER_URL = os.getenv("STACKSPOT_RUNTIME_MANAGER_URL") +STACKSPOT_WORKSPACE_URL = os.getenv("STACKSPOT_WORKSPACE_URL") inputs_list = [ENVIRONMENT, VERSION_TAG, CLIENT_ID, CLIENT_KEY, CLIENT_REALM, TF_STATE_BUCKET_NAME, TF_STATE_REGION, IAC_BUCKET_NAME, IAC_REGION] @@ -117,7 +118,7 @@ def get_env_id(slug, access_token): request_data = { **stk_id, - "envId": get_env_id(ENVIRONMENT, access_token), + "envId": get_env_id(ENVIRONMENT, access_token, STACKSPOT_WORKSPACE_URL), "tag": VERSION_TAG, "config": { "tfstate": { From 0301314b1d46c218e6ae067b54780def73017de3 Mon Sep 17 00:00:00 2001 From: Rodrigo Cury Date: Thu, 27 Mar 2025 13:38:11 -0300 Subject: [PATCH 3/4] Fixed Workspace URL --- action.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/action.yaml b/action.yaml index 2565800..59901eb 100644 --- a/action.yaml +++ b/action.yaml @@ -132,7 +132,6 @@ runs: STACKSPOT_IAM_URL: ${{ steps.stackspot-url.outputs.iam }} STACKSPOT_WORKSPACE_URL: ${{ steps.stackspot-url.outputs.workspace }} STACKSPOT_RUNTIME_MANAGER_URL: ${{ steps.stackspot-url.outputs.runtime_manager }} - STACKSPOT_WORKSPACE_URL run: | if [ ${{runner.os}} != 'Windows' ]; then python3 ${{ github.action_path }}/runtime.py From 9daabdc065e75f6ab71046388fcd96cc0744ce94 Mon Sep 17 00:00:00 2001 From: Rodrigo Cury Date: Thu, 27 Mar 2025 13:43:03 -0300 Subject: [PATCH 4/4] fix/endpoint --- runtime.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime.py b/runtime.py index ab6a0f8..2b20d08 100644 --- a/runtime.py +++ b/runtime.py @@ -150,7 +150,7 @@ def get_env_id(slug, access_token, workspace_url): data=request_data ) elif stk_yaml_type == 'infra': - self_hosted_rollback_infra_url = f"{STACKSPOT_RUNTIME_MANAGER_URL}/run/self-hosted/rollback/infra" + self_hosted_rollback_infra_url = f"{STACKSPOT_RUNTIME_MANAGER_URL}/v1/run/self-hosted/rollback/infra" rollback_request = requests.post( url=self_hosted_rollback_infra_url, headers=deploy_headers,