Skip to content

Commit c339f3b

Browse files
mik-kybec-callow-octtothegills
authored
Adds create release step in Octopus Deploy (#705)
* Adds create release step * Change output format to string --------- Co-authored-by: Bec Callow <bec.callow@octopus.com> Co-authored-by: Shane Gill <tothegills@users.noreply.github.com>
1 parent 1a6c1e2 commit c339f3b

File tree

2 files changed

+161
-0
lines changed

2 files changed

+161
-0
lines changed
Lines changed: 4 additions & 0 deletions
Loading
Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
version: "1.0"
2+
kind: step-type
3+
metadata:
4+
name: octopusdeploy-create-release
5+
version: 1.0.0
6+
title: Create a release in Octopus Deploy
7+
isPublic: true
8+
description: Create a release in Octopus Deploy
9+
sources:
10+
- "https://github.com/codefresh-io/steps/tree/master/incubating/octopusdeploy-create-release"
11+
stage: incubating
12+
official: true
13+
categories:
14+
- deployment
15+
icon:
16+
type: svg
17+
url: "https://cdn.jsdelivr.net/gh/codefresh-io/steps/incubating/octopusdeploy-create-release/create_release.svg"
18+
background: "#F4F6F8"
19+
maintainers:
20+
- name: OctopusDeploy
21+
examples:
22+
- description: Basic usage of the create release step
23+
workflow:
24+
create-release:
25+
type: octopusdeploy-create-release
26+
arguments:
27+
OCTOPUS_API_KEY: "${{OCTOPUS_API_KEY}}"
28+
OCTOPUS_URL: "${{OCTOPUS_URL}}"
29+
OCTOPUS_SPACE: "Spaces 1"
30+
PROJECT: "Project Name"
31+
- description: Complex usage of the create release step
32+
workflow:
33+
create-release:
34+
type: octopusdeploy-create-release
35+
arguments:
36+
OCTOPUS_API_KEY: "${{OCTOPUS_API_KEY}}"
37+
OCTOPUS_URL: "${{OCTOPUS_URL}}"
38+
OCTOPUS_SPACE: "Spaces 1"
39+
PROJECT: "Project Name"
40+
RELEASE_NUMBER: "1.0.0"
41+
CHANNEL: "Channel Name"
42+
GIT_REF: "refs/heads/main"
43+
GIT_COMMIT: "Commit ID"
44+
PACKAGE_VERSION: "1.0.0"
45+
PACKAGES:
46+
- "Package:1.0.0"
47+
RELEASE_NOTES: "This is a release note"
48+
RELEASE_NOTES_FILE: "/release-notes.txt"
49+
IGNORE_EXISTING: false
50+
spec:
51+
arguments: |-
52+
{
53+
"definitions": {},
54+
"$schema": "http://json-schema.org/draft-07/schema#",
55+
"type": "object",
56+
"name": "octopusdeploy-create-release",
57+
"additionalProperties": false,
58+
"patterns": [],
59+
"required": ["OCTOPUS_API_KEY", "OCTOPUS_URL", "OCTOPUS_SPACE", "PROJECT"],
60+
"properties": {
61+
"OCTOPUS_API_KEY": {
62+
"type": "string",
63+
"description": "API key for octopus deploy (required)"
64+
},
65+
"OCTOPUS_URL": {
66+
"type": "string",
67+
"description": "URL of the octopus deploy server (required)"
68+
},
69+
"OCTOPUS_SPACE": {
70+
"type": "string",
71+
"description": "API key for octopus deploy (required)"
72+
},
73+
"PROJECT": {
74+
"type": "string",
75+
"description": "The name of the project associated with this release (required)"
76+
},
77+
"RELEASE_NUMBER": {
78+
"type": "string",
79+
"description": "The release number to create (optional)"
80+
},
81+
"CHANNEL": {
82+
"type": "string",
83+
"description": "Name or ID of the channel to use"
84+
},
85+
"GIT_REF": {
86+
"type": "string",
87+
"description": "Git Reference e.g. refs/heads/main. Only relevant for config-as-code projects"
88+
},
89+
"GIT_COMMIT": {
90+
"type": "string",
91+
"description": "Git Commit Hash; Specify this in addition to Git Reference if you want to reference a commit other than the latest for that branch/tag."
92+
},
93+
"PACKAGE_VERSION": {
94+
"type": "string",
95+
"description": "Default version to use for all Packages"
96+
},
97+
"PACKAGES": {
98+
"type": "array",
99+
"description": "Version specification a specific packages. Format as {package}:{version}, {step}:{version} or {package-ref-name}:{packageOrStep}:{version}"
100+
},
101+
"RELEASE_NOTES": {
102+
"type": "string",
103+
"description": "Release notes to attach"
104+
},
105+
"RELEASE_NOTES_FILE": {
106+
"type": "string",
107+
"description": " Release notes to attach (from file)"
108+
},
109+
"IGNORE_EXISTING": {
110+
"type": "boolean",
111+
"description": "If a release with the same version exists, do nothing instead of failing."
112+
}
113+
}
114+
}
115+
returns: |-
116+
{
117+
"definitions": {},
118+
"$schema": "http://json-schema.org/draft-07/schema#",
119+
"type": "object",
120+
"patterns": [],
121+
"required": [
122+
"RELEASE"
123+
],
124+
"properties": {
125+
"RELEASE": {
126+
"type": "string",
127+
"description": "The release version that was created"
128+
}
129+
}
130+
}
131+
stepsTemplate: |-
132+
create-release:
133+
name: octopusdeploy-create-release
134+
image: octopuslabs/octopus-cli
135+
tag: latest
136+
commands:
137+
- OUTPUT=$(octopus release create
138+
--project "[[.Arguments.PROJECT]]"
139+
--no-prompt
140+
--output-format basic
141+
[[- if .Arguments.PACKAGE_VERSION ]] --package-version "[[ .Arguments.PACKAGE_VERSION ]]" [[ end ]]
142+
[[- range $val := .Arguments.PACKAGES ]] --package "[[ $val ]]" [[ end ]]
143+
[[- if .Arguments.RELEASE_NUMBER ]] --version "[[ .Arguments.RELEASE_NUMBER ]]" [[ end ]]
144+
[[- if .Arguments.CHANNEL ]] --channel "[[ .Arguments.CHANNEL ]]" [[ end ]]
145+
[[- if .Arguments.GIT_REF ]] --git-ref "[[ .Arguments.GIT_REF ]]" [[ end ]]
146+
[[- if .Arguments.GIT_COMMIT ]] --git-commit "[[ .Arguments.GIT_COMMIT ]]" [[ end ]]
147+
[[- if .Arguments.RELEASE_NOTES ]] --release-notes "[[ .Arguments.RELEASE_NOTES ]]" [[ end ]]
148+
[[- if .Arguments.RELEASE_NOTES_FILE ]] --release-notes-file "[[ .Arguments.RELEASE_NOTES_FILE ]]" [[ end ]]
149+
[[- if .Arguments.IGNORE_EXISTING ]] --ignore-existing [[ end ]])
150+
- cf_export RELEASE=$OUTPUT
151+
environment:
152+
- 'OCTOPUS_URL=[[.Arguments.OCTOPUS_URL]]'
153+
- 'OCTOPUS_API_KEY=[[.Arguments.OCTOPUS_API_KEY]]'
154+
- 'OCTOPUS_SPACE=[[.Arguments.OCTOPUS_SPACE]]'
155+
delimiters:
156+
left: "[["
157+
right: "]]"

0 commit comments

Comments
 (0)