Skip to content

Commit

Permalink
Add Octopus login step (#711)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
bec-callow-oct authored Nov 4, 2024
1 parent 9e5e01e commit 1e9e7f3
Show file tree
Hide file tree
Showing 8 changed files with 398 additions and 39 deletions.
67 changes: 60 additions & 7 deletions incubating/octopusdeploy-create-release/step.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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: |-
{
Expand All @@ -56,19 +96,27 @@ 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",
"description": "URL of the octopus deploy server (required)"
},
"OCTOPUS_SPACE": {
"type": "string",
"description": "API key for octopus deploy (required)"
"description": "Workspace for octopus deploy (required)"
},
"PROJECT": {
"type": "string",
Expand Down Expand Up @@ -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: "[["
Expand Down
71 changes: 64 additions & 7 deletions incubating/octopusdeploy-deploy-release-tenanted/step.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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: |-
{
Expand All @@ -60,19 +104,27 @@ 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",
"description": "URL of the octopus deploy server (required)"
},
"OCTOPUS_SPACE": {
"type": "string",
"description": "API key for octopus deploy (required)"
"description": "Workspace for octopus deploy (required)"
},
"PROJECT": {
"type": "string",
Expand Down Expand Up @@ -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
Expand Down
49 changes: 43 additions & 6 deletions incubating/octopusdeploy-deploy-release/step.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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: |-
{
Expand All @@ -44,19 +68,27 @@ 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",
"description": "URL of the octopus deploy server (required)"
},
"OCTOPUS_SPACE": {
"type": "string",
"description": "API key for octopus deploy (required)"
"description": "Workspace for octopus deploy (required)"
},
"PROJECT": {
"type": "string",
Expand Down Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions incubating/octopusdeploy-login/login.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 1e9e7f3

Please sign in to comment.