From a7b4122c23f0fcf8d9795ad681e74a6b91f45055 Mon Sep 17 00:00:00 2001 From: Chris Kim Date: Wed, 18 Sep 2024 17:50:34 +1200 Subject: [PATCH 1/2] Adds create package step --- .../create_package.svg | 9 ++ .../octopusdeploy-create-package/step.yaml | 123 ++++++++++++++++++ 2 files changed, 132 insertions(+) create mode 100644 incubating/octopusdeploy-create-package/create_package.svg create mode 100644 incubating/octopusdeploy-create-package/step.yaml diff --git a/incubating/octopusdeploy-create-package/create_package.svg b/incubating/octopusdeploy-create-package/create_package.svg new file mode 100644 index 000000000..eca5ce70b --- /dev/null +++ b/incubating/octopusdeploy-create-package/create_package.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/incubating/octopusdeploy-create-package/step.yaml b/incubating/octopusdeploy-create-package/step.yaml new file mode 100644 index 000000000..da5892d03 --- /dev/null +++ b/incubating/octopusdeploy-create-package/step.yaml @@ -0,0 +1,123 @@ +version: "1.0" +kind: step-type +metadata: + name: octopusdeploy-create-package + version: 1.0.0 + title: Create a package + isPublic: true + description: Creates a zip package in the format expected by Octopus Deploy + sources: + - "https://github.com/codefresh-io/steps/tree/master/incubating/octopusdeploy-create-package" + stage: incubating + official: true + categories: + - utility + icon: + type: svg + url: "https://cdn.jsdelivr.net/gh/codefresh-io/steps/incubating/octopusdeploy-create-package/create_package.svg" + background: "#F4F6F8" + maintainers: + - name: OctopusDeploy + examples: + - description: Package the current working directory + workflow: + create-package: + type: octopusdeploy-create-package + arguments: + ID: "SomePackage" + VERSION: "1.0.0" + - description: Complex usage + workflow: + create-package: + type: octopusdeploy-create-package + arguments: + ID: "SomePackage" + VERSION: "1.0.0" + BASE_PATH: "/codefresh/volume" + OUT_FOLDER: "/codefresh/volume" + INCLUDE: + - "*.html" + - "*.css" +spec: + arguments: |- + { + "definitions": {}, + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "name": "octopusdeploy-create-package", + "additionalProperties": false, + "patterns": [], + "required": ["ID", "VERSION"], + "properties": { + "ID": { + "type": "string", + "description": "The ID of the package. (required)" + }, + "VERSION": { + "type": "string", + "description": "The version of the package, must be a valid SemVer. (required)" + }, + "BASE_PATH": { + "type": "string", + "description": "Root folder containing the contents to zip. (optional)" + }, + "OUT_FOLDER": { + "type": "string", + "description": "Folder into which the zip file will be written. (optional)" + }, + "INCLUDE": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Add a file pattern to include, relative to the base path e.g. /bin/*.dll; defaults to '**'. (optional)" + }, + "OVERWRITE": { + "type": "boolean", + "description": "Allow an existing package file of the same ID/version to be overwritten. (optional)" + } + } + } + returns: |- + { + "definitions": {}, + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "additionalProperties": true, + "patterns": [], + "required": [ + "FILE" + ], + "properties": { + "FILE": { + "additionalProperties": true, + "type": "object", + "description": "The zip file that was created", + "properties": { + "Path": { + "type": "string", + "description": "The path to the zip file" + } + } + } + } + } + stepsTemplate: |- + create-package: + name: octopusdeploy-create-package + image: octopuslabs/octopus-cli + tag: latest + commands: + - OUTPUT=$(octopus package zip create + --id "[[ .Arguments.ID ]]" + --version "[[ .Arguments.VERSION ]]" + [[- if .Arguments.BASE_PATH ]] --base-path "[[ .Arguments.BASE_PATH ]]" [[ end ]] + [[- if .Arguments.OUT_FOLDER ]] --out-folder "[[ .Arguments.OUT_FOLDER ]]" [[ end ]] + [[- range $val := .Arguments.INCLUDE ]] --include "[[ $val ]]" [[ end ]] + [[- if .Arguments.OVERWRITE ]] --overwrite [[ end ]] + --output-format json + --no-prompt) + - cf_export FILE=$OUTPUT + delimiters: + left: "[[" + right: "]]" From 60ab651fbf30d1a4925e3602d30d9c9afdff8fe9 Mon Sep 17 00:00:00 2001 From: Bec Callow Date: Mon, 23 Sep 2024 11:11:51 +1000 Subject: [PATCH 2/2] Change output format to string --- .../octopusdeploy-create-package/step.yaml | 20 ++++++------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/incubating/octopusdeploy-create-package/step.yaml b/incubating/octopusdeploy-create-package/step.yaml index da5892d03..9de9cf7ab 100644 --- a/incubating/octopusdeploy-create-package/step.yaml +++ b/incubating/octopusdeploy-create-package/step.yaml @@ -83,22 +83,14 @@ spec: "definitions": {}, "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", - "additionalProperties": true, "patterns": [], "required": [ - "FILE" + "PATH" ], "properties": { - "FILE": { - "additionalProperties": true, - "type": "object", - "description": "The zip file that was created", - "properties": { - "Path": { - "type": "string", - "description": "The path to the zip file" - } - } + "PATH": { + "type": "string", + "description": "The zip file path that was created" } } } @@ -115,9 +107,9 @@ spec: [[- if .Arguments.OUT_FOLDER ]] --out-folder "[[ .Arguments.OUT_FOLDER ]]" [[ end ]] [[- range $val := .Arguments.INCLUDE ]] --include "[[ $val ]]" [[ end ]] [[- if .Arguments.OVERWRITE ]] --overwrite [[ end ]] - --output-format json + --output-format basic --no-prompt) - - cf_export FILE=$OUTPUT + - cf_export PATH="$OUTPUT" delimiters: left: "[[" right: "]]"