From 1e9e7f3fd5f6a619b2f440b6d92b870bdab7374e Mon Sep 17 00:00:00 2001 From: bec-callow-oct Date: Mon, 4 Nov 2024 19:00:55 +1000 Subject: [PATCH] Add Octopus login step (#711) * Add Octopus login step * Allow access key auth for create-release * Allow access key auth for deploy-release * Allow access key auth for deploy-release-tenanted * Allow access key auth for push-build-information * Allow access key auth for push-package * Allow access key auth for run-runbook * Add login step to workflow examples --- .../octopusdeploy-create-release/step.yaml | 67 +++++++++++++-- .../step.yaml | 71 ++++++++++++++-- .../octopusdeploy-deploy-release/step.yaml | 49 +++++++++-- incubating/octopusdeploy-login/login.svg | 7 ++ incubating/octopusdeploy-login/step.yaml | 83 +++++++++++++++++++ .../step.yaml | 45 ++++++++-- .../octopusdeploy-push-package/step.yaml | 43 ++++++++-- .../octopusdeploy-run-runbook/step.yaml | 72 ++++++++++++++-- 8 files changed, 398 insertions(+), 39 deletions(-) create mode 100644 incubating/octopusdeploy-login/login.svg create mode 100644 incubating/octopusdeploy-login/step.yaml diff --git a/incubating/octopusdeploy-create-release/step.yaml b/incubating/octopusdeploy-create-release/step.yaml index 43142edc..de3bb9c5 100644 --- a/incubating/octopusdeploy-create-release/step.yaml +++ b/incubating/octopusdeploy-create-release/step.yaml @@ -2,7 +2,7 @@ version: "1.0" kind: step-type metadata: name: octopusdeploy-create-release - version: 1.0.0 + version: 1.0.1 title: Create a release in Octopus Deploy isPublic: true description: Create a release in Octopus Deploy @@ -19,7 +19,7 @@ metadata: maintainers: - name: OctopusDeploy examples: - - description: Basic usage of the create release step + - description: Basic usage of the create release step with API key workflow: create-release: type: octopusdeploy-create-release @@ -28,7 +28,7 @@ metadata: OCTOPUS_URL: "${{OCTOPUS_URL}}" OCTOPUS_SPACE: "Spaces 1" PROJECT: "Project Name" - - description: Complex usage of the create release step + - description: Complex usage of the create release step with API key workflow: create-release: type: octopusdeploy-create-release @@ -47,6 +47,46 @@ metadata: RELEASE_NOTES: "This is a release note" RELEASE_NOTES_FILE: "/release-notes.txt" IGNORE_EXISTING: false + - description: Basic usage of the create release step with Octopus access token + workflow: + login: + type: octopusdeploy-login + arguments: + ID_TOKEN: "${{ID_TOKEN}}" + OCTOPUS_URL: "${{OCTOPUS_URL}}" + OCTOPUS_SERVICE_ACCOUNT_ID: "${{OCTOPUS_SERVICE_ACCOUNT_ID}}" + create-release: + type: octopusdeploy-create-release + arguments: + OCTOPUS_ACCESS_TOKEN: "${{OCTOPUS_ACCESS_TOKEN}}" + OCTOPUS_URL: "${{OCTOPUS_URL}}" + OCTOPUS_SPACE: "Spaces 1" + PROJECT: "Project Name" + - description: Complex usage of the create release step with Octopus access token + workflow: + login: + type: octopusdeploy-login + arguments: + ID_TOKEN: "${{ID_TOKEN}}" + OCTOPUS_URL: "${{OCTOPUS_URL}}" + OCTOPUS_SERVICE_ACCOUNT_ID: "${{OCTOPUS_SERVICE_ACCOUNT_ID}}" + create-release: + type: octopusdeploy-create-release + arguments: + OCTOPUS_ACCESS_TOKEN: "${{OCTOPUS_ACCESS_TOKEN}}" + OCTOPUS_URL: "${{OCTOPUS_URL}}" + OCTOPUS_SPACE: "Spaces 1" + PROJECT: "Project Name" + RELEASE_NUMBER: "1.0.0" + CHANNEL: "Channel Name" + GIT_REF: "refs/heads/main" + GIT_COMMIT: "Commit ID" + PACKAGE_VERSION: "1.0.0" + PACKAGES: + - "Package:1.0.0" + RELEASE_NOTES: "This is a release note" + RELEASE_NOTES_FILE: "/release-notes.txt" + IGNORE_EXISTING: false spec: arguments: |- { @@ -56,11 +96,19 @@ spec: "name": "octopusdeploy-create-release", "additionalProperties": false, "patterns": [], - "required": ["OCTOPUS_API_KEY", "OCTOPUS_URL", "OCTOPUS_SPACE", "PROJECT"], + "required": ["OCTOPUS_URL", "OCTOPUS_SPACE", "PROJECT"], + "oneOf": [ + {"required": ["OCTOPUS_API_KEY"]}, + {"required": ["OCTOPUS_ACCESS_TOKEN"]} + ], "properties": { "OCTOPUS_API_KEY": { "type": "string", - "description": "API key for octopus deploy (required)" + "description": "API key for octopus deploy (required when OCTOPUS_ACCESS_TOKEN is not provided)" + }, + "OCTOPUS_ACCESS_TOKEN": { + "type": "string", + "description": "Access token for octopus deploy (required when OCTOPUS_API_KEY is not provided)" }, "OCTOPUS_URL": { "type": "string", @@ -68,7 +116,7 @@ spec: }, "OCTOPUS_SPACE": { "type": "string", - "description": "API key for octopus deploy (required)" + "description": "Workspace for octopus deploy (required)" }, "PROJECT": { "type": "string", @@ -149,8 +197,13 @@ spec: [[- if .Arguments.IGNORE_EXISTING ]] --ignore-existing [[ end ]]) - cf_export RELEASE=$OUTPUT environment: - - 'OCTOPUS_URL=[[.Arguments.OCTOPUS_URL]]' + [[ if .Arguments.OCTOPUS_API_KEY ]] - 'OCTOPUS_API_KEY=[[.Arguments.OCTOPUS_API_KEY]]' + [[- end ]] + [[ if .Arguments.OCTOPUS_ACCESS_TOKEN ]] + - 'OCTOPUS_ACCESS_TOKEN=[[.Arguments.OCTOPUS_ACCESS_TOKEN]]' + [[- end ]] + - 'OCTOPUS_URL=[[.Arguments.OCTOPUS_URL]]' - 'OCTOPUS_SPACE=[[.Arguments.OCTOPUS_SPACE]]' delimiters: left: "[[" diff --git a/incubating/octopusdeploy-deploy-release-tenanted/step.yaml b/incubating/octopusdeploy-deploy-release-tenanted/step.yaml index 416c8d91..b292d46f 100644 --- a/incubating/octopusdeploy-deploy-release-tenanted/step.yaml +++ b/incubating/octopusdeploy-deploy-release-tenanted/step.yaml @@ -2,7 +2,7 @@ version: "1.0" kind: step-type metadata: name: octopusdeploy-deploy-release-tenanted - version: 1.0.1 + version: 1.0.2 title: Deploy a tenanted release in Octopus Deploy isPublic: true description: Deploy a tenanted release in Octopus Deploy @@ -19,7 +19,7 @@ metadata: maintainers: - name: OctopusDeploy examples: - - description: "Deploy using tenant name" + - description: "Deploy using tenant name and API key" workflow: deploy-release-tenanted: type: octopusdeploy-deploy-release-tenanted @@ -37,7 +37,7 @@ metadata: - "prompted-variable1:prompted-value1" - "prompted-variable2:prompted-value2" USE_GUIDED_FAILURE: "false" - - description: "Deploy using tenant tags" + - description: "Deploy using tenant tags and API key" workflow: deploy-release-tenanted: type: octopusdeploy-deploy-release-tenanted @@ -51,6 +51,50 @@ metadata: TENANT_TAGS: - "tagSetA/someTagB" - "tagSetC/someTagD" + - description: "Deploy using tenant name and Octopus access token" + workflow: + login: + type: octopusdeploy-login + arguments: + ID_TOKEN: "${{ID_TOKEN}}" + OCTOPUS_URL: "${{OCTOPUS_URL}}" + OCTOPUS_SERVICE_ACCOUNT_ID: "${{OCTOPUS_SERVICE_ACCOUNT_ID}}" + deploy-release-tenanted: + type: octopusdeploy-deploy-release-tenanted + arguments: + OCTOPUS_ACCESS_TOKEN: "${{OCTOPUS_ACCESS_TOKEN}}" + OCTOPUS_URL: "${{OCTOPUS_URL}}" + OCTOPUS_SPACE: "Spaces-1" + PROJECT: "Project Name" + RELEASE_NUMBER: "1.0.0" + ENVIRONMENT: "Production" + TENANTS: + - "Tenant1" + - "Tenant2" + VARIABLES: + - "prompted-variable1:prompted-value1" + - "prompted-variable2:prompted-value2" + USE_GUIDED_FAILURE: "false" + - description: "Deploy using tenant tags and Octopus access token" + workflow: + login: + type: octopusdeploy-login + arguments: + ID_TOKEN: "${{ID_TOKEN}}" + OCTOPUS_URL: "${{OCTOPUS_URL}}" + OCTOPUS_SERVICE_ACCOUNT_ID: "${{OCTOPUS_SERVICE_ACCOUNT_ID}}" + deploy-release-tenanted: + type: octopusdeploy-deploy-release-tenanted + arguments: + OCTOPUS_ACCESS_TOKEN: "${{OCTOPUS_ACCESS_TOKEN}}" + OCTOPUS_URL: "${{OCTOPUS_URL}}" + OCTOPUS_SPACE: "Spaces-1" + PROJECT: "Another Project Name" + RELEASE_NUMBER: "2.0.0" + ENVIRONMENT: "Development" + TENANT_TAGS: + - "tagSetA/someTagB" + - "tagSetC/someTagD" spec: arguments: |- { @@ -60,11 +104,19 @@ spec: "name": "octopusdeploy-deploy-release-tenanted", "additionalProperties": false, "patterns": [], - "required": ["OCTOPUS_API_KEY", "OCTOPUS_URL", "OCTOPUS_SPACE", "PROJECT", "RELEASE_NUMBER", "ENVIRONMENT"], + "required": ["OCTOPUS_URL", "OCTOPUS_SPACE", "PROJECT", "RELEASE_NUMBER", "ENVIRONMENT"], + "oneOf": [ + {"required": ["OCTOPUS_API_KEY"]}, + {"required": ["OCTOPUS_ACCESS_TOKEN"]} + ], "properties": { "OCTOPUS_API_KEY": { "type": "string", - "description": "API key for octopus deploy (required)" + "description": "API key for octopus deploy (required when OCTOPUS_ACCESS_TOKEN is not provided)" + }, + "OCTOPUS_ACCESS_TOKEN": { + "type": "string", + "description": "Access token for octopus deploy (required when OCTOPUS_API_KEY is not provided)" }, "OCTOPUS_URL": { "type": "string", @@ -72,7 +124,7 @@ spec: }, "OCTOPUS_SPACE": { "type": "string", - "description": "API key for octopus deploy (required)" + "description": "Workspace for octopus deploy (required)" }, "PROJECT": { "type": "string", @@ -154,8 +206,13 @@ spec: name: octopusdeploy-deploy-release-tenanted image: octopuslabs/octopus-cli environment: - - 'OCTOPUS_URL=[[.Arguments.OCTOPUS_URL]]' + [[ if .Arguments.OCTOPUS_API_KEY ]] - 'OCTOPUS_API_KEY=[[.Arguments.OCTOPUS_API_KEY]]' + [[- end ]] + [[ if .Arguments.OCTOPUS_ACCESS_TOKEN ]] + - 'OCTOPUS_ACCESS_TOKEN=[[.Arguments.OCTOPUS_ACCESS_TOKEN]]' + [[- end ]] + - 'OCTOPUS_URL=[[.Arguments.OCTOPUS_URL]]' - 'OCTOPUS_SPACE=[[.Arguments.OCTOPUS_SPACE]]' commands: - OUTPUT=$(octopus release deploy diff --git a/incubating/octopusdeploy-deploy-release/step.yaml b/incubating/octopusdeploy-deploy-release/step.yaml index 205e7fea..91b66cdd 100644 --- a/incubating/octopusdeploy-deploy-release/step.yaml +++ b/incubating/octopusdeploy-deploy-release/step.yaml @@ -2,7 +2,7 @@ version: "1.0" kind: step-type metadata: name: octopusdeploy-deploy-release - version: 1.0.0 + version: 1.0.1 title: Deploy a release in Octopus Deploy isPublic: true description: Deploy a release in Octopus Deploy @@ -19,7 +19,8 @@ metadata: maintainers: - name: OctopusDeploy examples: - - workflow: + - description: Usage of the deploy release with API key + workflow: deploy-release: type: octopusdeploy-deploy-release arguments: @@ -35,6 +36,29 @@ metadata: - "prompted-variable1:prompted-value1" - "prompted-variable2:prompted-value2" USE_GUIDED_FAILURE: "false" + - description: Usage of the deploy release with Octopus access token + workflow: + login: + type: octopusdeploy-login + arguments: + ID_TOKEN: "${{ID_TOKEN}}" + OCTOPUS_URL: "${{OCTOPUS_URL}}" + OCTOPUS_SERVICE_ACCOUNT_ID: "${{OCTOPUS_SERVICE_ACCOUNT_ID}}" + deploy-release: + type: octopusdeploy-deploy-release + arguments: + OCTOPUS_ACCESS_TOKEN: "${{OCTOPUS_ACCESS_TOKEN}}" + OCTOPUS_URL: "${{OCTOPUS_URL}}" + OCTOPUS_SPACE: "Spaces-1" + PROJECT: "Project Name" + RELEASE_NUMBER: "1.0.0" + ENVIRONMENTS: + - "Development" + - "Production" + VARIABLES: + - "prompted-variable1:prompted-value1" + - "prompted-variable2:prompted-value2" + USE_GUIDED_FAILURE: "false" spec: arguments: |- { @@ -44,11 +68,19 @@ spec: "name": "octopusdeploy-deploy-release", "additionalProperties": false, "patterns": [], - "required": ["OCTOPUS_API_KEY", "OCTOPUS_URL", "OCTOPUS_SPACE", "PROJECT", "RELEASE_NUMBER", "ENVIRONMENTS"], + "required": ["OCTOPUS_URL", "OCTOPUS_SPACE", "PROJECT", "RELEASE_NUMBER", "ENVIRONMENTS"], + "oneOf": [ + {"required": ["OCTOPUS_API_KEY"]}, + {"required": ["OCTOPUS_ACCESS_TOKEN"]} + ], "properties": { "OCTOPUS_API_KEY": { "type": "string", - "description": "API key for octopus deploy (required)" + "description": "API key for octopus deploy (required when OCTOPUS_ACCESS_TOKEN is not provided)" + }, + "OCTOPUS_ACCESS_TOKEN": { + "type": "string", + "description": "Access token for octopus deploy (required when OCTOPUS_API_KEY is not provided)" }, "OCTOPUS_URL": { "type": "string", @@ -56,7 +88,7 @@ spec: }, "OCTOPUS_SPACE": { "type": "string", - "description": "API key for octopus deploy (required)" + "description": "Workspace for octopus deploy (required)" }, "PROJECT": { "type": "string", @@ -127,8 +159,13 @@ spec: name: octopusdeploy-deploy-release image: octopuslabs/octopus-cli environment: - - 'OCTOPUS_URL=[[.Arguments.OCTOPUS_URL]]' + [[ if .Arguments.OCTOPUS_API_KEY ]] - 'OCTOPUS_API_KEY=[[.Arguments.OCTOPUS_API_KEY]]' + [[- end ]] + [[ if .Arguments.OCTOPUS_ACCESS_TOKEN ]] + - 'OCTOPUS_ACCESS_TOKEN=[[.Arguments.OCTOPUS_ACCESS_TOKEN]]' + [[- end ]] + - 'OCTOPUS_URL=[[.Arguments.OCTOPUS_URL]]' - 'OCTOPUS_SPACE=[[.Arguments.OCTOPUS_SPACE]]' commands: - OUTPUT=$(octopus release deploy diff --git a/incubating/octopusdeploy-login/login.svg b/incubating/octopusdeploy-login/login.svg new file mode 100644 index 00000000..5cf4648d --- /dev/null +++ b/incubating/octopusdeploy-login/login.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/incubating/octopusdeploy-login/step.yaml b/incubating/octopusdeploy-login/step.yaml new file mode 100644 index 00000000..16015ee1 --- /dev/null +++ b/incubating/octopusdeploy-login/step.yaml @@ -0,0 +1,83 @@ +version: "1.0" +kind: step-type +metadata: + name: octopusdeploy-login + version: 1.0.0 + title: Log into Octopus Deploy + isPublic: true + description: Log into Octopus Deploy + sources: + - "https://github.com/codefresh-io/steps/tree/master/incubating/octopusdeploy-login" + stage: incubating + official: true + categories: + - utility + icon: + type: svg + url: "https://cdn.jsdelivr.net/gh/codefresh-io/steps/incubating/octopusdeploy-login/login.svg" + background: "#F4F6F8" + maintainers: + - name: OctopusDeploy + examples: + - description: Basic usage of the login step + workflow: + login: + type: octopusdeploy-login + arguments: + ID_TOKEN: "${{ID_TOKEN}}" + OCTOPUS_URL: "${{OCTOPUS_URL}}" + OCTOPUS_SERVICE_ACCOUNT_ID: "${{OCTOPUS_SERVICE_ACCOUNT_ID}}" +spec: + arguments: |- + { + "definitions": {}, + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "name": "octopusdeploy-login", + "additionalProperties": false, + "patterns": [], + "required": ["ID_TOKEN", "OCTOPUS_URL", "OCTOPUS_SERVICE_ACCOUNT_ID"], + "properties": { + "ID_TOKEN": { + "type": "string", + "description": "The Codefresh OIDC token (required)" + }, + "OCTOPUS_URL": { + "type": "string", + "description": "URL of the octopus deploy server (required)" + }, + "OCTOPUS_SERVICE_ACCOUNT_ID": { + "type": "string", + "description": "The ID (audience) of the Octopus Service Account to log into (required)" + } + } + } + returns: |- + { + "definitions": {}, + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "patterns": [], + "required": [ + "OCTOPUS_ACCESS_TOKEN" + ], + "properties": { + "OCTOPUS_ACCESS_TOKEN": { + "type": "string", + "description": "Access token for octopus deploy (required)" + } + } + } + stepsTemplate: |- + login: + name: octopusdeploy-login + image: octopuslabs/octopus-cli + tag: latest + environment: + - ID_TOKEN_SECRET=[[ .Arguments.ID_TOKEN ]] + commands: + - octopus login --server "[[ .Arguments.OCTOPUS_URL ]]" --service-account-id "[[ .Arguments.OCTOPUS_SERVICE_ACCOUNT_ID ]]" --id-token "${ID_TOKEN_SECRET}" --no-prompt + - cf_export OCTOPUS_ACCESS_TOKEN=$(octopus config get "AccessToken") --mask + delimiters: + left: "[[" + right: "]]" diff --git a/incubating/octopusdeploy-push-build-information/step.yaml b/incubating/octopusdeploy-push-build-information/step.yaml index 10331d43..b993f388 100644 --- a/incubating/octopusdeploy-push-build-information/step.yaml +++ b/incubating/octopusdeploy-push-build-information/step.yaml @@ -2,7 +2,7 @@ version: "1.0" kind: step-type metadata: name: octopusdeploy-push-build-information - version: 1.0.0 + version: 1.0.1 title: Push build information to Octopus Deploy isPublic: true description: Push build information to Octopus Deploy @@ -19,7 +19,7 @@ metadata: maintainers: - name: OctopusDeploy examples: - - description: Basic usage of the push build information step + - description: Basic usage of the push build information step with API key workflow: push-build-information: type: octopusdeploy-push-build-information @@ -33,6 +33,26 @@ metadata: FILE: "SomeFile.json" VERSION: "1.0.0" OVERWRITE_MODE: "fail" + - description: Basic usage of the push build information step with Octopus access token + workflow: + login: + type: octopusdeploy-login + arguments: + ID_TOKEN: "${{ID_TOKEN}}" + OCTOPUS_URL: "${{OCTOPUS_URL}}" + OCTOPUS_SERVICE_ACCOUNT_ID: "${{OCTOPUS_SERVICE_ACCOUNT_ID}}" + push-build-information: + type: octopusdeploy-push-build-information + arguments: + OCTOPUS_ACCESS_TOKEN: "${{OCTOPUS_ACCESS_TOKEN}}" + OCTOPUS_URL: "${{OCTOPUS_URL}}" + OCTOPUS_SPACE: "Spaces 1" + PACKAGE_IDS: + - "SomePackage" + - "SomeOtherPackage" + FILE: "SomeFile.json" + VERSION: "1.0.0" + OVERWRITE_MODE: "fail" spec: arguments: |- { @@ -42,11 +62,19 @@ spec: "name": "octopusdeploy-push-build-information", "additionalProperties": false, "patterns": [], - "required": ["OCTOPUS_API_KEY", "OCTOPUS_URL", "OCTOPUS_SPACE", "PACKAGE_IDS", "FILE", "VERSION"], + "required": ["OCTOPUS_URL", "OCTOPUS_SPACE", "PACKAGE_IDS", "FILE", "VERSION"], + "oneOf": [ + {"required": ["OCTOPUS_API_KEY"]}, + {"required": ["OCTOPUS_ACCESS_TOKEN"]} + ], "properties": { "OCTOPUS_API_KEY": { "type": "string", - "description": "API key for octopus deploy (required)" + "description": "API key for octopus deploy (required when OCTOPUS_ACCESS_TOKEN is not provided)" + }, + "OCTOPUS_ACCESS_TOKEN": { + "type": "string", + "description": "Access token for octopus deploy (required when OCTOPUS_API_KEY is not provided)" }, "OCTOPUS_URL": { "type": "string", @@ -54,7 +82,7 @@ spec: }, "OCTOPUS_SPACE": { "type": "string", - "description": "API key for octopus deploy (required)" + "description": "Workspace for octopus deploy (required)" }, "PACKAGE_IDS": { "type": "array", @@ -90,8 +118,13 @@ spec: [[- if .Arguments.OVERWRITE_MODE ]] --overwrite-mode "[[ .Arguments.OVERWRITE_MODE ]]" [[ end ]] --no-prompt environment: - - 'OCTOPUS_URL=[[.Arguments.OCTOPUS_URL]]' + [[ if .Arguments.OCTOPUS_API_KEY ]] - 'OCTOPUS_API_KEY=[[.Arguments.OCTOPUS_API_KEY]]' + [[- end ]] + [[ if .Arguments.OCTOPUS_ACCESS_TOKEN ]] + - 'OCTOPUS_ACCESS_TOKEN=[[.Arguments.OCTOPUS_ACCESS_TOKEN]]' + [[- end ]] + - 'OCTOPUS_URL=[[.Arguments.OCTOPUS_URL]]' - 'OCTOPUS_SPACE=[[.Arguments.OCTOPUS_SPACE]]' delimiters: left: "[[" diff --git a/incubating/octopusdeploy-push-package/step.yaml b/incubating/octopusdeploy-push-package/step.yaml index 9b3ff0d9..8f8911b6 100644 --- a/incubating/octopusdeploy-push-package/step.yaml +++ b/incubating/octopusdeploy-push-package/step.yaml @@ -2,7 +2,7 @@ version: "1.0" kind: step-type metadata: name: octopusdeploy-push-package - version: 1.0.0 + version: 1.0.1 title: Push a package in Octopus Deploy isPublic: true description: Push a package in Octopus Deploy @@ -19,7 +19,7 @@ metadata: maintainers: - name: OctopusDeploy examples: - - description: Basic usage of the push a package step + - description: Basic usage of the push a package step with API key workflow: push-package: type: octopusdeploy-push-package @@ -31,6 +31,24 @@ metadata: - "SomePackage.1.0.0.zip" - "SomeOtherPackage.1.0.0.zip" OVERWRITE_MODE: "fail" + - description: Basic usage of the push a package step with Octopus access token + workflow: + login: + type: octopusdeploy-login + arguments: + ID_TOKEN: "${{ID_TOKEN}}" + OCTOPUS_URL: "${{OCTOPUS_URL}}" + OCTOPUS_SERVICE_ACCOUNT_ID: "${{OCTOPUS_SERVICE_ACCOUNT_ID}}" + push-package: + type: octopusdeploy-push-package + arguments: + OCTOPUS_ACCESS_TOKEN: "${{OCTOPUS_ACCESS_TOKEN}}" + OCTOPUS_URL: "${{OCTOPUS_URL}}" + OCTOPUS_SPACE: "Spaces 1" + PACKAGES: + - "SomePackage.1.0.0.zip" + - "SomeOtherPackage.1.0.0.zip" + OVERWRITE_MODE: "fail" spec: arguments: |- { @@ -40,11 +58,19 @@ spec: "name": "octopusdeploy-push-package", "additionalProperties": false, "patterns": [], - "required": ["OCTOPUS_API_KEY", "OCTOPUS_URL", "OCTOPUS_SPACE", "PACKAGES"], + "required": ["OCTOPUS_URL", "OCTOPUS_SPACE", "PACKAGES"], + "oneOf": [ + {"required": ["OCTOPUS_API_KEY"]}, + {"required": ["OCTOPUS_ACCESS_TOKEN"]} + ], "properties": { "OCTOPUS_API_KEY": { "type": "string", - "description": "API key for octopus deploy (required)" + "description": "API key for octopus deploy (required when OCTOPUS_ACCESS_TOKEN is not provided)" + }, + "OCTOPUS_ACCESS_TOKEN": { + "type": "string", + "description": "Access token for octopus deploy (required when OCTOPUS_API_KEY is not provided)" }, "OCTOPUS_URL": { "type": "string", @@ -52,7 +78,7 @@ spec: }, "OCTOPUS_SPACE": { "type": "string", - "description": "API key for octopus deploy (required)" + "description": "Workspace for octopus deploy (required)" }, "PACKAGES": { "type": "array", @@ -78,8 +104,13 @@ spec: [[- if .Arguments.OVERWRITE_MODE ]] --overwrite-mode "[[ .Arguments.OVERWRITE_MODE ]]" [[ end ]] --no-prompt environment: - - 'OCTOPUS_URL=[[.Arguments.OCTOPUS_URL]]' + [[ if .Arguments.OCTOPUS_API_KEY ]] - 'OCTOPUS_API_KEY=[[.Arguments.OCTOPUS_API_KEY]]' + [[- end ]] + [[ if .Arguments.OCTOPUS_ACCESS_TOKEN ]] + - 'OCTOPUS_ACCESS_TOKEN=[[.Arguments.OCTOPUS_ACCESS_TOKEN]]' + [[- end ]] + - 'OCTOPUS_URL=[[.Arguments.OCTOPUS_URL]]' - 'OCTOPUS_SPACE=[[.Arguments.OCTOPUS_SPACE]]' delimiters: left: "[[" diff --git a/incubating/octopusdeploy-run-runbook/step.yaml b/incubating/octopusdeploy-run-runbook/step.yaml index 25b6a051..95df6cb2 100644 --- a/incubating/octopusdeploy-run-runbook/step.yaml +++ b/incubating/octopusdeploy-run-runbook/step.yaml @@ -2,7 +2,7 @@ version: "1.0" kind: step-type metadata: name: octopusdeploy-run-runbook - version: 1.0.0 + version: 1.0.1 title: Run a runbook in Octopus Deploy isPublic: true description: Run a runbook in Octopus Deploy @@ -19,7 +19,7 @@ metadata: maintainers: - name: OctopusDeploy examples: - - description: Basic usage of the run a runbook step + - description: Basic usage of the run a runbook step with API key workflow: run-runbook: type: octopusdeploy-run-runbook @@ -32,7 +32,7 @@ metadata: ENVIRONMENTS: - "Development" - "Production" - - description: Complex usage of the run a runbook step + - description: Complex usage of the run a runbook step with API key workflow: run-runbook: type: octopusdeploy-run-runbook @@ -52,6 +52,51 @@ metadata: TENANT_TAGS: - "Tenant tag 1" USE_GUIDED_FAILURE: "false" + - description: Basic usage of the run a runbook step with Octopus access token + workflow: + login: + type: octopusdeploy-login + arguments: + ID_TOKEN: "${{ID_TOKEN}}" + OCTOPUS_URL: "${{OCTOPUS_URL}}" + OCTOPUS_SERVICE_ACCOUNT_ID: "${{OCTOPUS_SERVICE_ACCOUNT_ID}}" + run-runbook: + type: octopusdeploy-run-runbook + arguments: + OCTOPUS_ACCESS_TOKEN: "${{OCTOPUS_ACCESS_TOKEN}}" + OCTOPUS_URL: "${{OCTOPUS_URL}}" + OCTOPUS_SPACE: "Spaces 1" + PROJECT: "Project Name" + NAME: "Runbook Name" + ENVIRONMENTS: + - "Development" + - "Production" + - description: Complex usage of the run a runbook step with Octopus access token + workflow: + login: + type: octopusdeploy-login + arguments: + ID_TOKEN: "${{ID_TOKEN}}" + OCTOPUS_URL: "${{OCTOPUS_URL}}" + OCTOPUS_SERVICE_ACCOUNT_ID: "${{OCTOPUS_SERVICE_ACCOUNT_ID}}" + run-runbook: + type: octopusdeploy-run-runbook + arguments: + OCTOPUS_ACCESS_TOKEN: "${{OCTOPUS_ACCESS_TOKEN}}" + OCTOPUS_URL: "${{OCTOPUS_URL}}" + OCTOPUS_SPACE: "Spaces 1" + PROJECT: "Project Name" + NAME: "Runbook Name" + ENVIRONMENTS: + - "Development" + - "Production" + VARIABLES: + - "Label:Value" + TENANTS: + - "Tenant 1" + TENANT_TAGS: + - "Tenant tag 1" + USE_GUIDED_FAILURE: "false" spec: arguments: |- { @@ -61,11 +106,19 @@ spec: "name": "octopusdeploy-run-runbook", "additionalProperties": false, "patterns": [], - "required": ["OCTOPUS_API_KEY", "OCTOPUS_URL", "OCTOPUS_SPACE", "PROJECT", "NAME", "ENVIRONMENTS"], + "required": ["OCTOPUS_URL", "OCTOPUS_SPACE", "PROJECT", "NAME", "ENVIRONMENTS"], + "oneOf": [ + {"required": ["OCTOPUS_API_KEY"]}, + {"required": ["OCTOPUS_ACCESS_TOKEN"]} + ], "properties": { "OCTOPUS_API_KEY": { "type": "string", - "description": "API key for octopus deploy (required)" + "description": "API key for octopus deploy (required when OCTOPUS_ACCESS_TOKEN is not provided)" + }, + "OCTOPUS_ACCESS_TOKEN": { + "type": "string", + "description": "Access token for octopus deploy (required when OCTOPUS_API_KEY is not provided)" }, "OCTOPUS_URL": { "type": "string", @@ -73,7 +126,7 @@ spec: }, "OCTOPUS_SPACE": { "type": "string", - "description": "API key for octopus deploy (required)" + "description": "Workspace for octopus deploy (required)" }, "PROJECT": { "type": "string", @@ -171,8 +224,13 @@ spec: --no-prompt) - cf_export RUNBOOK_RUNS=$OUTPUT environment: - - 'OCTOPUS_URL=[[.Arguments.OCTOPUS_URL]]' + [[ if .Arguments.OCTOPUS_API_KEY ]] - 'OCTOPUS_API_KEY=[[.Arguments.OCTOPUS_API_KEY]]' + [[- end ]] + [[ if .Arguments.OCTOPUS_ACCESS_TOKEN ]] + - 'OCTOPUS_ACCESS_TOKEN=[[.Arguments.OCTOPUS_ACCESS_TOKEN]]' + [[- end ]] + - 'OCTOPUS_URL=[[.Arguments.OCTOPUS_URL]]' - 'OCTOPUS_SPACE=[[.Arguments.OCTOPUS_SPACE]]' delimiters: left: "[["