From 71316f4c68c08c349ef055e2c9d667fb8483c116 Mon Sep 17 00:00:00 2001 From: Dustin Van Buskirk Date: Wed, 22 Jun 2022 15:17:29 -0700 Subject: [PATCH 1/7] initial commit --- incubating/codefresh-report-image/LICENSE | 21 ++ incubating/codefresh-report-image/step.yaml | 204 ++++++++++++++++++++ 2 files changed, 225 insertions(+) create mode 100644 incubating/codefresh-report-image/LICENSE create mode 100644 incubating/codefresh-report-image/step.yaml diff --git a/incubating/codefresh-report-image/LICENSE b/incubating/codefresh-report-image/LICENSE new file mode 100644 index 000000000..8a6ff206e --- /dev/null +++ b/incubating/codefresh-report-image/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 Codefresh + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/incubating/codefresh-report-image/step.yaml b/incubating/codefresh-report-image/step.yaml new file mode 100644 index 000000000..7eccec1cb --- /dev/null +++ b/incubating/codefresh-report-image/step.yaml @@ -0,0 +1,204 @@ +kind: step-type +version: '1.0' +metadata: + name: codefresh-report-image + version: 1.0.0 + isPublic: true + description: Report Docker Image Metadata to Codefresh CD + sources: + - https://github.com/codefresh-io/steps/tree/master/incubating/codefresh-report-image + stage: incubating + maintainers: + - name: Dustin Van Buskirk + email: dustin@codefresh.io + categories: + - utilities + official: true + tags: [] + icon: + type: svg + url: https://raw.githubusercontent.com/codefresh-io/steps/master/incubating/codefresh-report-image/icon.svg + background: "#f4f4f4" + examples: + - description: report-image-metadata + workflow: + ReportImageMetadata: + type: codefresh-report-image + arguments: + CF_API_KEY: codefresh-cd-api-token + CF_IMAGE: docker.io/${CF_REPO_OWNER}/${CF_REPO_NAME} + CF_HOST: https://codefresh.mydomain.com + CF_LOGS_URL: ${CF_BUILD_URL} + CF_WORKFLOW_URL: ${CF_URL}/pipelines/edit/workflow?pipeline=${CF_PIPELINE_NAME} + - description: report-image-metadata-all + workflow: + ReportImageMetadataAll: + type: codefresh-report-image + arguments: + CF_API_KEY: codefresh-cd-api-token + CF_IMAGE: docker.io/${CF_REPO_OWNER}/${CF_REPO_NAME} + CF_HOST: https://codefresh.mydomain.com + CF_LOGS_URL: ${CF_BUILD_URL} + CF_WORKFLOW_URL: ${CF_URL}/pipelines/edit/workflow?pipeline=${CF_PIPELINE_NAME} + CF_ENRICHERS: jira, git + CF_GITHUB_TOKEN: token + CF_GIT_PROVIDER: github + CF_GIT_REPO: ${CF_REPO} + CF_GIT_BRANCH: ${CF_BRANCH} + CF_JIRA_API_TOKEN: atlassian-jira-api-token + CF_JIRA_EMAIL: dustin@codefresh.io + CF_JIRA_HOST_URL: https://codefresh-io.atlassian.net + CF_JIRA_MESSAGE: ${CF_COMMIT_MESSAGE} + CF_PROJECT_PREFIX: SA +spec: + arguments: |- + { + "definitions": {}, + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "additionalProperties": true, + "patterns": [], + "required": [ + "CF_API_KEY", + "CF_IMAGE", + "CF_HOST" + ], + "properties": { + "CF_API_KEY": { + "type": "string", + "description": "API Key from Codefresh CD platform." + }, + "CF_CI_TYPE": { + "type": "string", + "description": "Name of integration type.", + "default": "codefresh" + }, + "CF_CONTAINER_REGISTRY_INTEGRATION": { + "type": "string", + "description": "Registry integration name." + }, + "CF_DOCKERHUB_PASSWORD": { + "type": "string", + "description": "When no registry integration is specified: dockerhub token as password." + }, + "CF_DOCKERHUB_USERNAME": { + "type": "string", + "description": "When no registry integration is specified: dockerhub username." + }, + "CF_ENRICHERS": { + "type": "string", + "description": "Comma delimited list of integrations for collecting metadata on the build image/" + }, + "CF_GIT_BRANCH": { + "type": "string", + "description": "The git branch which is related for the commit." + }, + "CF_GIT_PROVIDER": { + "type": "string", + "description": "The git integration type use (i.e. github)" + }, + "CF_GIT_REPO": { + "type": "string", + "description": "The the git repository used for building the image." + }, + "CF_GITHUB_API_URL": { + "type": "string", + "description": "Specify github host api url.", + "default": "https://api.github.com" + }, + "CF_GITHUB_TOKEN": { + "type": "string", + "description": "Github personal access token. Scope: repo." + }, + "CF_HOST": { + "type": "string", + "description": "Codefresh Runtime Ingress URL. (ie. https://codefresh.mycompany.com)" + }, + "CF_JIRA_API_TOKEN": { + "type": "string", + "description": "When no jira integration is specified: Jira token for authenticating." + }, + "CF_IMAGE": { + "type": "string", + "description": "Fully qualified image name to be reported to Codefresh CD. (i.e. docker.io/codefresh/example-app:1.0.0)" + }, + "CF_JIRA_EMAIL": { + "type": "string", + "description": "When no jira integration is specified: user email for authenticating with jira." + }, + "CF_JIRA_FAIL_ON_NOT_FOUND": { + "type": "string", + "description": "Fail pipeline if 'issue' not found." + }, + "CF_JIRA_INTEGRATION": { + "type": "string", + "description": "When jira integration name is specified instead of providing explicit credentials." + }, + "CF_JIRA_HOST_URL": { + "type": "string", + "description": "When no jira integration is specified: The jira server url. (i.e. https://codefresh-io.atlassian.net/)" + }, + "CF_JIRA_MESSAGE": { + "type": "string", + "description": "The message to parse for JIRA ticket. (i.e. fix SA-45)" + }, + "CF_JIRA_PROJECT_PREFIX": { + "type": "string", + "description": "Jira prefix for identifying the ticket number to use. (i.e. CR)" + }, + "CF_LOGS_URL": { + "type": "string", + "description": "URL to build logs." + }, + "CF_REGISTRY_DOMAIN": { + "type": "string", + "description": "When no registry integration is specified: registry domain." + }, + "CF_REGISTRY_INSECURE": { + "type": "boolean", + "description": "All insecure registry." + }, + "CF_REGISTRY_PASSWORD": { + "type": "string", + "description": "When no registry integration is specified: registry token/password." + }, + "CF_REGISTRY_USERNAME": { + "type": "string", + "description": "When no registry integration is specified: registry username." + }, + "CF_WORKFLOW_NAME": { + "type": "string", + "description": "Given workflow name parameter." + }, + "CF_WORKFLOW_URL": { + "type": "string", + "description": "Reported url of the workflow building the image." + }, + "REGISTRY": { + "type": "string", + "description": "Docker Registry for step's image.", + "default": "quay.io" + }, + "IMAGE": { + "type": "string", + "description": "Image name for step's image.", + "default": "codefresh/csdp-report-image" + }, + "IMAGE_TAG": { + "type": "string", + "description": "Image tag for step's image.", + "default": "0.0.40" + } + } + } + stepsTemplate: |- + codefresh-report-image: + name: codefresh-report-image + image: '[[.Arguments.REGISTRY]]/[[.Arguments.IMAGE]]:[[.Arguments.IMAGE_TAG]]' + environment: + [[ range $key, $val := .Arguments ]] + - '[[ $key ]]=[[ $val ]]' + [[- end ]] + delimiters: + left: '[[' + right: ']]' From d7e993bcde57fc56a42711e52c958c22e905aa8d Mon Sep 17 00:00:00 2001 From: Dustin Van Buskirk Date: Tue, 12 Jul 2022 15:52:55 -0700 Subject: [PATCH 2/7] finalizing --- .../Codefresh_Logo_Vertical_LightBkgd.svg | 15 +++++++ incubating/codefresh-report-image/step.yaml | 39 ++++++++----------- 2 files changed, 32 insertions(+), 22 deletions(-) create mode 100644 incubating/codefresh-report-image/Codefresh_Logo_Vertical_LightBkgd.svg diff --git a/incubating/codefresh-report-image/Codefresh_Logo_Vertical_LightBkgd.svg b/incubating/codefresh-report-image/Codefresh_Logo_Vertical_LightBkgd.svg new file mode 100644 index 000000000..5230d5e9b --- /dev/null +++ b/incubating/codefresh-report-image/Codefresh_Logo_Vertical_LightBkgd.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/incubating/codefresh-report-image/step.yaml b/incubating/codefresh-report-image/step.yaml index 7eccec1cb..f4fc43d0c 100644 --- a/incubating/codefresh-report-image/step.yaml +++ b/incubating/codefresh-report-image/step.yaml @@ -1,9 +1,9 @@ kind: step-type version: '1.0' metadata: - name: codefresh-report-image + name: dustinvanbuskirk/codefresh-report-image version: 1.0.0 - isPublic: true + isPublic: false description: Report Docker Image Metadata to Codefresh CD sources: - https://github.com/codefresh-io/steps/tree/master/incubating/codefresh-report-image @@ -17,7 +17,7 @@ metadata: tags: [] icon: type: svg - url: https://raw.githubusercontent.com/codefresh-io/steps/master/incubating/codefresh-report-image/icon.svg + url: https://raw.githubusercontent.com/codefresh-io/steps/master/incubating/codefresh-report-image/Codefresh_Logo_Vertical_LightBkgd.svg background: "#f4f4f4" examples: - description: report-image-metadata @@ -26,30 +26,28 @@ metadata: type: codefresh-report-image arguments: CF_API_KEY: codefresh-cd-api-token - CF_IMAGE: docker.io/${CF_REPO_OWNER}/${CF_REPO_NAME} + CF_IMAGE: docker.io/${{CF_REPO_OWNER}}/${{CF_REPO_NAME}}:${{CF_REVISION}} CF_HOST: https://codefresh.mydomain.com - CF_LOGS_URL: ${CF_BUILD_URL} - CF_WORKFLOW_URL: ${CF_URL}/pipelines/edit/workflow?pipeline=${CF_PIPELINE_NAME} + CF_WORKFLOW_URL: ${{CF_BUILD_URL}} - description: report-image-metadata-all workflow: ReportImageMetadataAll: type: codefresh-report-image arguments: CF_API_KEY: codefresh-cd-api-token - CF_IMAGE: docker.io/${CF_REPO_OWNER}/${CF_REPO_NAME} + CF_IMAGE: docker.io/${{CF_REPO_OWNER}}/${{CF_REPO_NAME}}:${{CF_REVISION}} CF_HOST: https://codefresh.mydomain.com - CF_LOGS_URL: ${CF_BUILD_URL} - CF_WORKFLOW_URL: ${CF_URL}/pipelines/edit/workflow?pipeline=${CF_PIPELINE_NAME} + CF_WORKFLOW_URL: ${{CF_BUILD_URL}} CF_ENRICHERS: jira, git - CF_GITHUB_TOKEN: token + CF_GITHUB_TOKEN: ${{GITHUB_TOKEN}} CF_GIT_PROVIDER: github - CF_GIT_REPO: ${CF_REPO} - CF_GIT_BRANCH: ${CF_BRANCH} - CF_JIRA_API_TOKEN: atlassian-jira-api-token + CF_GIT_REPO: ${{CF_REPO_OWNER}}/${{CF_REPO_NAME}} + CF_GIT_BRANCH: ${{CF_BRANCH}} + CF_JIRA_API_TOKEN: ${{JIRA_TOKEN}} CF_JIRA_EMAIL: dustin@codefresh.io CF_JIRA_HOST_URL: https://codefresh-io.atlassian.net - CF_JIRA_MESSAGE: ${CF_COMMIT_MESSAGE} - CF_PROJECT_PREFIX: SA + CF_JIRA_MESSAGE: ${{CF_COMMIT_MESSAGE}} + CF_JIRA_PROJECT_PREFIX: SA spec: arguments: |- { @@ -71,7 +69,7 @@ spec: "CF_CI_TYPE": { "type": "string", "description": "Name of integration type.", - "default": "codefresh" + "default": "" }, "CF_CONTAINER_REGISTRY_INTEGRATION": { "type": "string", @@ -146,10 +144,6 @@ spec: "type": "string", "description": "Jira prefix for identifying the ticket number to use. (i.e. CR)" }, - "CF_LOGS_URL": { - "type": "string", - "description": "URL to build logs." - }, "CF_REGISTRY_DOMAIN": { "type": "string", "description": "When no registry integration is specified: registry domain." @@ -182,12 +176,12 @@ spec: "IMAGE": { "type": "string", "description": "Image name for step's image.", - "default": "codefresh/csdp-report-image" + "default": "codefresh/codefresh-report-image" }, "IMAGE_TAG": { "type": "string", "description": "Image tag for step's image.", - "default": "0.0.40" + "default": "0.0.83" } } } @@ -195,6 +189,7 @@ spec: codefresh-report-image: name: codefresh-report-image image: '[[.Arguments.REGISTRY]]/[[.Arguments.IMAGE]]:[[.Arguments.IMAGE_TAG]]' + working_directory: /code environment: [[ range $key, $val := .Arguments ]] - '[[ $key ]]=[[ $val ]]' From e2c5f8a1bbf6b86fa3ba9fbe5d9675f8eb6488b3 Mon Sep 17 00:00:00 2001 From: Dustin Van Buskirk Date: Tue, 12 Jul 2022 15:55:38 -0700 Subject: [PATCH 3/7] make public --- incubating/codefresh-report-image/step.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/incubating/codefresh-report-image/step.yaml b/incubating/codefresh-report-image/step.yaml index f4fc43d0c..5fb1103a3 100644 --- a/incubating/codefresh-report-image/step.yaml +++ b/incubating/codefresh-report-image/step.yaml @@ -1,9 +1,9 @@ kind: step-type version: '1.0' metadata: - name: dustinvanbuskirk/codefresh-report-image + name: codefresh-report-image version: 1.0.0 - isPublic: false + isPublic: true description: Report Docker Image Metadata to Codefresh CD sources: - https://github.com/codefresh-io/steps/tree/master/incubating/codefresh-report-image From 1c70cec45a4962de3179526c3ac89bf3f5075cc2 Mon Sep 17 00:00:00 2001 From: Dustin Van Buskirk Date: Tue, 12 Jul 2022 16:19:58 -0700 Subject: [PATCH 4/7] add workdir and title to examples --- incubating/codefresh-report-image/step.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/incubating/codefresh-report-image/step.yaml b/incubating/codefresh-report-image/step.yaml index 5fb1103a3..d7b0a5aa8 100644 --- a/incubating/codefresh-report-image/step.yaml +++ b/incubating/codefresh-report-image/step.yaml @@ -23,7 +23,9 @@ metadata: - description: report-image-metadata workflow: ReportImageMetadata: + title: Report image to Codefresh CD type: codefresh-report-image + working_directory: /code arguments: CF_API_KEY: codefresh-cd-api-token CF_IMAGE: docker.io/${{CF_REPO_OWNER}}/${{CF_REPO_NAME}}:${{CF_REVISION}} @@ -32,7 +34,9 @@ metadata: - description: report-image-metadata-all workflow: ReportImageMetadataAll: + title: Report image to Codefresh CD type: codefresh-report-image + working_directory: /code arguments: CF_API_KEY: codefresh-cd-api-token CF_IMAGE: docker.io/${{CF_REPO_OWNER}}/${{CF_REPO_NAME}}:${{CF_REVISION}} From 679caf0704b981bed8401269a67997617f7d6272 Mon Sep 17 00:00:00 2001 From: Laurent Date: Tue, 12 Jul 2022 16:35:00 -0700 Subject: [PATCH 5/7] Change description of jira and container integration to make it clear it references GitOps side Signed-off-by: Laurent --- incubating/codefresh-report-image/step.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/incubating/codefresh-report-image/step.yaml b/incubating/codefresh-report-image/step.yaml index 5fb1103a3..c35983793 100644 --- a/incubating/codefresh-report-image/step.yaml +++ b/incubating/codefresh-report-image/step.yaml @@ -73,7 +73,7 @@ spec: }, "CF_CONTAINER_REGISTRY_INTEGRATION": { "type": "string", - "description": "Registry integration name." + "description": "Codefresh Gitops Registry integration name." }, "CF_DOCKERHUB_PASSWORD": { "type": "string", @@ -130,7 +130,7 @@ spec: }, "CF_JIRA_INTEGRATION": { "type": "string", - "description": "When jira integration name is specified instead of providing explicit credentials." + "description": "When Codefresh GitOps jira integration name is specified instead of providing explicit credentials." }, "CF_JIRA_HOST_URL": { "type": "string", From bf8934a91d7e7bb87efea0dea0a7a7705fb688b5 Mon Sep 17 00:00:00 2001 From: Laurent Date: Wed, 13 Jul 2022 07:50:51 -0700 Subject: [PATCH 6/7] Removing CF_CI_TYPE as a patmeter and forcing it to classic Signed-off-by: Laurent --- incubating/codefresh-report-image/step.yaml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/incubating/codefresh-report-image/step.yaml b/incubating/codefresh-report-image/step.yaml index f36babe9f..e1eddff58 100644 --- a/incubating/codefresh-report-image/step.yaml +++ b/incubating/codefresh-report-image/step.yaml @@ -70,11 +70,6 @@ spec: "type": "string", "description": "API Key from Codefresh CD platform." }, - "CF_CI_TYPE": { - "type": "string", - "description": "Name of integration type.", - "default": "" - }, "CF_CONTAINER_REGISTRY_INTEGRATION": { "type": "string", "description": "Codefresh Gitops Registry integration name." @@ -195,6 +190,7 @@ spec: image: '[[.Arguments.REGISTRY]]/[[.Arguments.IMAGE]]:[[.Arguments.IMAGE_TAG]]' working_directory: /code environment: + - CF_CI_TYPE=classic [[ range $key, $val := .Arguments ]] - '[[ $key ]]=[[ $val ]]' [[- end ]] From e058b3c7e2d7d7870e64b2a2b14f3b97714477b7 Mon Sep 17 00:00:00 2001 From: Laurent Date: Wed, 13 Jul 2022 08:48:59 -0700 Subject: [PATCH 7/7] Removing CF_WORKFLOW_URL as a parameter and forcing it to classic Signed-off-by: Laurent --- incubating/codefresh-report-image/step.yaml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/incubating/codefresh-report-image/step.yaml b/incubating/codefresh-report-image/step.yaml index e1eddff58..dadc78973 100644 --- a/incubating/codefresh-report-image/step.yaml +++ b/incubating/codefresh-report-image/step.yaml @@ -30,7 +30,6 @@ metadata: CF_API_KEY: codefresh-cd-api-token CF_IMAGE: docker.io/${{CF_REPO_OWNER}}/${{CF_REPO_NAME}}:${{CF_REVISION}} CF_HOST: https://codefresh.mydomain.com - CF_WORKFLOW_URL: ${{CF_BUILD_URL}} - description: report-image-metadata-all workflow: ReportImageMetadataAll: @@ -41,7 +40,6 @@ metadata: CF_API_KEY: codefresh-cd-api-token CF_IMAGE: docker.io/${{CF_REPO_OWNER}}/${{CF_REPO_NAME}}:${{CF_REVISION}} CF_HOST: https://codefresh.mydomain.com - CF_WORKFLOW_URL: ${{CF_BUILD_URL}} CF_ENRICHERS: jira, git CF_GITHUB_TOKEN: ${{GITHUB_TOKEN}} CF_GIT_PROVIDER: github @@ -163,10 +161,6 @@ spec: "type": "string", "description": "Given workflow name parameter." }, - "CF_WORKFLOW_URL": { - "type": "string", - "description": "Reported url of the workflow building the image." - }, "REGISTRY": { "type": "string", "description": "Docker Registry for step's image.", @@ -191,6 +185,7 @@ spec: working_directory: /code environment: - CF_CI_TYPE=classic + - CF_WORKFLOW_URL=${{CF_BUILD_URL}} [[ range $key, $val := .Arguments ]] - '[[ $key ]]=[[ $val ]]' [[- end ]]