Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 7 additions & 2 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,20 +93,24 @@ 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"
STACKSPOT_WORKSPACE_URL="https://workspace-workspace-api.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"
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

Expand All @@ -126,6 +130,7 @@ 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 }}
run: |
if [ ${{runner.os}} != 'Windows' ]; then
Expand Down
9 changes: 5 additions & 4 deletions runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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]

Expand Down Expand Up @@ -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": {
Expand Down Expand Up @@ -149,7 +150,7 @@ def get_env_id(slug, access_token):
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,
Expand Down