Skip to content

Commit 367c692

Browse files
Merge branch 'main' of github.com:codefresh-io/csdp-report-image
2 parents 56aa72e + b2e49c3 commit 367c692

File tree

3 files changed

+76
-50
lines changed

3 files changed

+76
-50
lines changed

action.yaml

Lines changed: 60 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,64 @@
11
name: 'csdp-report-image'
22
description: 'Report image to csdp'
33
inputs:
4-
inputs:
5-
CF_IMAGE:
6-
required: true
7-
type: string
8-
CONTAINER_REGISTRY_INTEGRATION:
9-
required: false
10-
type: string
11-
CF_ENRICHERS:
12-
required: false
13-
type: string
14-
CF_INSECURE:
15-
required: false
16-
type: string
17-
CF_WORKFLOW_URL:
18-
required: false
19-
type: string
20-
CF_LOGS_URL:
21-
required: false
22-
type: string
23-
CF_GIT_BRANCH:
24-
required: false
25-
type: string
26-
CF_GIT_SHA:
27-
required: false
28-
type: string
29-
CF_GIT_REPO:
30-
required: false
31-
type: string
32-
CF_GIT_INTEGRATION:
33-
required: false
34-
type: string
35-
CF_JIRA_PROJECT_PREFIX:
36-
required: false
37-
type: string
38-
CF_JIRA_MESSAGE:
39-
required: false
40-
type: string
41-
CF_JIRA_INTEGRATION:
42-
required: false
43-
type: string
44-
CF_JIRA_FAIL_ON_NOT_FOUND:
45-
required: false
46-
type: string
47-
secrets:
48-
CF_API_KEY:
49-
required: true
4+
VERSION:
5+
description: specify client version
6+
required: false
7+
default: 0.0.21
8+
CF_IMAGE:
9+
description: image reported, quay.io/codefresh/newly-built-image:0.0.1
10+
required: true
11+
CF_HOST:
12+
description: "cluster address address: https://g.codefresh.io"
13+
required: false
14+
CF_VERBOSE:
15+
description: "verbose output"
16+
required: false
17+
CONTAINER_REGISTRY_INTEGRATION:
18+
required: false
19+
description: list of enrichers separated by commas
20+
CF_ENRICHERS:
21+
required: false
22+
description: "list of integrations separated by commas: jira, github"
23+
CF_INSECURE:
24+
required: false
25+
description: "security flag for standard registry protocol, when set to true it enables http protocol"
26+
CF_WORKFLOW_URL:
27+
required: false
28+
description: "external url for the workflow"
29+
CF_LOGS_URL:
30+
required: false
31+
description: "external url for the logs"
32+
CF_GIT_BRANCH:
33+
required: false
34+
description: "The git branch to use to enrich"
35+
CF_GIT_SHA:
36+
required: false
37+
description: "The git SHA to use to enrich"
38+
CF_GIT_REPO:
39+
required: false
40+
description: "The GitHub repo to use to enrich"
41+
CF_GIT_INTEGRATION:
42+
required: false
43+
description: "The integration key"
44+
CF_JIRA_PROJECT_PREFIX:
45+
required: false
46+
description: "Jira project prefix"
47+
CF_JIRA_MESSAGE:
48+
required: false
49+
description: "String that contains PREFIX-ISSUE_ID"
50+
CF_JIRA_INTEGRATION:
51+
required: false
52+
description: "The integration key"
53+
CF_JIRA_FAIL_ON_NOT_FOUND:
54+
required: false
55+
description: "fail in case of ticket not found"
56+
CF_API_KEY:
57+
description: "Codefresh API KEY"
58+
required: true
5059
runs:
51-
using: 'docker'
52-
image: 'safficodefresh/csdp-report-image:latest'
60+
using: "composite"
61+
steps:
62+
- shell: bash
63+
run: |
64+
docker run --env-file=cf_env quay.io/codefresh/csdp-report-image:$INPUT_VERSION

service.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
name: csdp-report-image
2-
version: 0.0.14
2+
version: 0.0.21

src/validate.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Validate mandatory env vars. address host default
33
*/
44
export function validate(payload: Record<string, string|undefined>): Record<string, string|undefined> {
5-
const filtered = filterEnvVarPattern(payload)
5+
const filtered = { ...filterEnvVarPattern(payload), ...filterGitActionsEnvVarInputPattern(payload) }
66
const messages: string[] = []
77
if (!filtered['CF_API_KEY']) {
88
messages.push(`CF_API_KEY must be provided as environment variable.`)
@@ -30,3 +30,17 @@ function filterEnvVarPattern(env: Record<string, string|undefined>): Record<stri
3030
return obj
3131
}, {})
3232
}
33+
34+
/**
35+
* Filter git actions env for codefresh vars prefix
36+
* @param env
37+
*/
38+
function filterGitActionsEnvVarInputPattern(env: Record<string, string|undefined>): Record<string, string|undefined> {
39+
const from = 'INPUT_'.length
40+
return Object.keys(env)
41+
.filter(key => (/^INPUT_CF_[A-Z_]+$/.test(key)))
42+
.reduce((obj, key) => {
43+
obj[key.slice(from)] = env[key]
44+
return obj
45+
}, {})
46+
}

0 commit comments

Comments
 (0)