Skip to content

Commit

Permalink
Merge branch 'master' into fnm/deployTenantedRelease
Browse files Browse the repository at this point in the history
  • Loading branch information
tothegills authored Sep 23, 2024
2 parents 62f0f06 + fe63a7a commit f50de3e
Show file tree
Hide file tree
Showing 4 changed files with 348 additions and 0 deletions.
10 changes: 10 additions & 0 deletions incubating/octopusdeploy-deploy-release/deploy_release.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
145 changes: 145 additions & 0 deletions incubating/octopusdeploy-deploy-release/step.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
version: "1.0"
kind: step-type
metadata:
name: octopusdeploy-deploy-release
version: 1.0.0
title: Deploy a release in Octopus Deploy
isPublic: true
description: Deploy a release in Octopus Deploy
sources:
- "https://github.com/codefresh-io/steps/tree/master/incubating/octopusdeploy-deploy-release"
stage: incubating
official: true
categories:
- deployment
icon:
type: svg
url: "https://cdn.jsdelivr.net/gh/codefresh-io/steps/incubating/octopusdeploy-deploy-release/deploy_release.svg"
background: "#F4F6F8"
maintainers:
- name: OctopusDeploy
examples:
- workflow:
deploy-release:
type: octopusdeploy-deploy-release
arguments:
OCTOPUS_API_KEY: "${{OCTOPUS_API_KEY}}"
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: |-
{
"definitions": {},
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"name": "octopusdeploy-deploy-release",
"additionalProperties": false,
"patterns": [],
"required": ["OCTOPUS_API_KEY", "OCTOPUS_URL", "OCTOPUS_SPACE", "PROJECT", "RELEASE_NUMBER", "ENVIRONMENTS"],
"properties": {
"OCTOPUS_API_KEY": {
"type": "string",
"description": "API key for octopus deploy (required)"
},
"OCTOPUS_URL": {
"type": "string",
"description": "URL of the octopus deploy server (required)"
},
"OCTOPUS_SPACE": {
"type": "string",
"description": "API key for octopus deploy (required)"
},
"PROJECT": {
"type": "string",
"description": "The name of the project associated with this release (required)"
},
"RELEASE_NUMBER": {
"type": "string",
"description": "The release number to deploy (required)"
},
"ENVIRONMENTS": {
"type": "array",
"items": {
"type": "string"
},
"description": "The list of environment names to deploy to (required)"
},
"VARIABLES": {
"type": "array",
"items": {
"type": "string"
},
"description": "Set the value for a prompted variable in the format Label:Value (optional)"
},
"USE_GUIDED_FAILURE": {
"type": "string",
"description": "A multi-line list of prompted variable values. Format: name:value (optional)"
}
}
}
returns: |-
{
"definitions": {},
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"additionalProperties": true,
"patterns": [],
"required": [
"DEPLOYMENTS"
],
"properties": {
"DEPLOYMENTS": {
"type": "array",
"description": "The list of deployments",
"items": {
"type": "object",
"additionalProperties": true,
"patterns": [],
"required": [
"DeploymentId",
"ServerTaskId"
],
"properties": {
"DeploymentId": {
"type": "string",
"description": "The deployment Id"
},
"ServerTaskId": {
"type": "string",
"description": "The server task Id"
}
}
}
}
}
}
stepsTemplate: |-
deploy-release:
name: octopusdeploy-deploy-release
image: octopuslabs/octopus-cli
environment:
- 'OCTOPUS_URL=[[.Arguments.OCTOPUS_URL]]'
- 'OCTOPUS_API_KEY=[[.Arguments.OCTOPUS_API_KEY]]'
- 'OCTOPUS_SPACE=[[.Arguments.OCTOPUS_SPACE]]'
commands:
- OUTPUT=$(octopus release deploy
--project "[[.Arguments.PROJECT]]"
--version "[[.Arguments.RELEASE_NUMBER]]"
--no-prompt
--output-format json
[[- range $val := .Arguments.ENVIRONMENTS ]] --environment "[[ $val ]]" [[ end ]]
[[- range $val := .Arguments.VARIABLES ]] --variable "[[ $val ]]" [[ end ]]
[[- if .Arguments.USE_GUIDED_FAILURE ]] --guided-failure "[[ .Arguments.USE_GUIDED_FAILURE ]]" [[ end ]])
- cf_export DEPLOYMENTS=$OUTPUT
delimiters:
left: "[["
right: "]]"
14 changes: 14 additions & 0 deletions incubating/octopusdeploy-run-runbook/run_a_runbook.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
179 changes: 179 additions & 0 deletions incubating/octopusdeploy-run-runbook/step.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
version: "1.0"
kind: step-type
metadata:
name: octopusdeploy-run-runbook
version: 1.0.0
title: Run a runbook in Octopus Deploy
isPublic: true
description: Run a runbook in Octopus Deploy
sources:
- "https://github.com/codefresh-io/steps/tree/master/incubating/octopusdeploy-run-runbook"
stage: incubating
official: true
categories:
- deployment
icon:
type: svg
url: "https://cdn.jsdelivr.net/gh/codefresh-io/steps/incubating/octopusdeploy-run-runbook/run_a_runbook.svg"
background: "#F4F6F8"
maintainers:
- name: OctopusDeploy
examples:
- description: Basic usage of the run a runbook step
workflow:
run-runbook:
type: octopusdeploy-run-runbook
arguments:
OCTOPUS_API_KEY: "${{OCTOPUS_API_KEY}}"
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
workflow:
run-runbook:
type: octopusdeploy-run-runbook
arguments:
OCTOPUS_API_KEY: "${{OCTOPUS_API_KEY}}"
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: |-
{
"definitions": {},
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"name": "octopusdeploy-run-runbook",
"additionalProperties": false,
"patterns": [],
"required": ["OCTOPUS_API_KEY", "OCTOPUS_URL", "OCTOPUS_SPACE", "PROJECT", "NAME", "ENVIRONMENTS"],
"properties": {
"OCTOPUS_API_KEY": {
"type": "string",
"description": "API key for octopus deploy (required)"
},
"OCTOPUS_URL": {
"type": "string",
"description": "URL of the octopus deploy server (required)"
},
"OCTOPUS_SPACE": {
"type": "string",
"description": "API key for octopus deploy (required)"
},
"PROJECT": {
"type": "string",
"description": "The name of the project associated with this release (required)"
},
"NAME": {
"type": "string",
"description": "Name of the runbook to run (required)"
},
"ENVIRONMENTS": {
"type": "array",
"items": {
"type": "string"
},
"description": "The environment names to run in (required)"
},
"VARIABLES": {
"type": "array",
"items": {
"type": "string"
},
"description": "Set the value for a prompted variable in the format Label:Value (optional)"
},
"TENANTS": {
"type": "array",
"items": {
"type": "string"
},
"description": "Run for these tenants (optional)"
},
"TENANT_TAGS": {
"type": "array",
"items": {
"type": "string"
},
"description": "Run for tenants matching these tags (optional)"
},
"USE_GUIDED_FAILURE": {
"type": "string",
"description": "Enable Guided failure mode (true/false/default) (optional)"
}
}
}
returns: |-
{
"definitions": {},
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"additionalProperties": true,
"patterns": [],
"required": [
"RUNBOOK_RUNS"
],
"properties": {
"RUNBOOK_RUNS": {
"type": "array",
"description": "The list of runbook runs",
"items": {
"type": "object",
"additionalProperties": true,
"patterns": [],
"required": [
"RunbookRunId",
"ServerTaskId"
],
"properties": {
"RunbookRunId": {
"type": "string",
"description": "The runbook run Id"
},
"ServerTaskId": {
"type": "string",
"description": "The server task Id"
}
}
}
}
}
}
stepsTemplate: |-
run-runbook:
name: octopusdeploy-run-runbook
image: octopuslabs/octopus-cli
tag: latest
commands:
- OUTPUT=$(octopus runbook run
--project "[[.Arguments.PROJECT]]"
--name "[[.Arguments.NAME]]"
[[- range $val := .Arguments.ENVIRONMENTS ]] --environment "[[ $val ]]" [[ end ]]
[[- range $val := .Arguments.VARIABLES ]] --variable "[[ $val ]]" [[ end ]]
[[- range $val := .Arguments.TENANTS ]] --tenant "[[ $val ]]" [[ end ]]
[[- range $val := .Arguments.TENANT_TAGS ]] --tenant-tag "[[ $val ]]" [[ end ]]
[[- if .Arguments.USE_GUIDED_FAILURE ]] --guided-failure "[[ .Arguments.USE_GUIDED_FAILURE ]]" [[ end ]]
--output-format json
--no-prompt)
- cf_export RUNBOOK_RUNS=$OUTPUT
environment:
- 'OCTOPUS_URL=[[.Arguments.OCTOPUS_URL]]'
- 'OCTOPUS_API_KEY=[[.Arguments.OCTOPUS_API_KEY]]'
- 'OCTOPUS_SPACE=[[.Arguments.OCTOPUS_SPACE]]'
delimiters:
left: "[["
right: "]]"

0 comments on commit f50de3e

Please sign in to comment.