Skip to content

Commit 55d1b30

Browse files
Merge branch 'main' of github.com:codefresh-io/csdp-report-image
2 parents 367c692 + 788004b commit 55d1b30

File tree

3 files changed

+32
-23
lines changed

3 files changed

+32
-23
lines changed

action.yaml

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@ inputs:
44
VERSION:
55
description: specify client version
66
required: false
7-
default: 0.0.21
7+
default: 0.0.26
88
CF_IMAGE:
99
description: image reported, quay.io/codefresh/newly-built-image:0.0.1
1010
required: true
1111
CF_HOST:
12-
description: "cluster address address: https://g.codefresh.io"
13-
required: false
12+
description: "CSDP app-proxy exposed in cluster address: https://your.clusters.ci-cd.com/app-proxy"
13+
required: true
1414
CF_VERBOSE:
1515
description: "verbose output"
1616
required: false
17-
CONTAINER_REGISTRY_INTEGRATION:
17+
CF_CONTAINER_REGISTRY_INTEGRATION:
1818
required: false
19-
description: list of enrichers separated by commas
19+
description: "list of container integration"
2020
CF_ENRICHERS:
2121
required: false
2222
description: "list of integrations separated by commas: jira, github"
@@ -60,5 +60,26 @@ runs:
6060
using: "composite"
6161
steps:
6262
- shell: bash
63+
env:
64+
VERSION: ${{ inputs.VERSION }}
65+
CF_IMAGE: ${{ inputs.CF_IMAGE }}
66+
CF_HOST: ${{ inputs.CF_HOST }}
67+
CF_VERBOSE: ${{ inputs.CF_VERBOSE }}
68+
CF_CONTAINER_REGISTRY_INTEGRATION: ${{ inputs.CF_CONTAINER_REGISTRY_INTEGRATION }}
69+
CF_ENRICHERS: ${{ inputs.CF_ENRICHERS }}
70+
CF_INSECURE: ${{ inputs.CF_INSECURE }}
71+
CF_WORKFLOW_URL: ${{ inputs.CF_WORKFLOW_URL }}
72+
CF_LOGS_URL: ${{ inputs.CF_LOGS_URL }}
73+
CF_GIT_BRANCH: ${{ inputs.CF_GIT_BRANCH }}
74+
CF_GIT_SHA: ${{ inputs.CF_GIT_SHA }}
75+
CF_GIT_REPO: ${{ inputs.CF_GIT_REPO }}
76+
CF_GIT_INTEGRATION: ${{ inputs.CF_GIT_INTEGRATION }}
77+
CF_JIRA_PROJECT_PREFIX: ${{ inputs.CF_JIRA_PROJECT_PREFIX }}
78+
CF_JIRA_MESSAGE: ${{ inputs.CF_JIRA_MESSAGE }}
79+
CF_JIRA_INTEGRATION: ${{ inputs.CF_JIRA_INTEGRATION }}
80+
CF_JIRA_FAIL_ON_NOT_FOUND: ${{ inputs.CF_JIRA_FAIL_ON_NOT_FOUND }}
81+
CF_API_KEY: ${{ inputs.CF_API_KEY }}
6382
run: |
64-
docker run --env-file=cf_env quay.io/codefresh/csdp-report-image:$INPUT_VERSION
83+
env>cf_env
84+
echo 'CF_CI_TYPE="github-actions"' >> cf_env
85+
docker run --env-file=cf_env quay.io/codefresh/csdp-report-image:$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.21
2+
version: 0.0.26

src/validate.ts

Lines changed: 4 additions & 16 deletions
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), ...filterGitActionsEnvVarInputPattern(payload) }
5+
const filtered = filterEnvVarPattern(payload)
66
const messages: string[] = []
77
if (!filtered['CF_API_KEY']) {
88
messages.push(`CF_API_KEY must be provided as environment variable.`)
@@ -26,21 +26,9 @@ function filterEnvVarPattern(env: Record<string, string|undefined>): Record<stri
2626
return Object.keys(env)
2727
.filter(key => (/^CF_[A-Z_]+$/.test(key)))
2828
.reduce((obj, key) => {
29-
obj[key] = env[key]
30-
return obj
31-
}, {})
32-
}
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]
29+
if (env[key]) { // skip empty
30+
obj[key] = env[key]
31+
}
4432
return obj
4533
}, {})
4634
}

0 commit comments

Comments
 (0)