Skip to content

Commit ea96878

Browse files
fix(dockerfile): take GITHUB_TOKEN from secrets (#748)
## What This takes `GITHUB_TOKEN` from secrets instead of build args. ## Why Security reasons. ## Notes —
1 parent 6f3f1e8 commit ea96878

File tree

4 files changed

+20
-6
lines changed

4 files changed

+20
-6
lines changed

Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ RUN adduser \
1313
--uid 10001 \
1414
codefresh
1515

16-
ARG GITHUB_TOKEN
17-
RUN git config \
16+
RUN --mount=type=secret,id=GITHUB_TOKEN \
17+
GITHUB_TOKEN=$(cat /run/secrets/GITHUB_TOKEN) \
18+
git config \
1819
--global \
1920
url."https://github:${GITHUB_TOKEN}@github.com".insteadOf \
2021
"https://github.com"

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VERSION=v0.1.62
1+
VERSION=v0.1.63
22

33
OUT_DIR=dist
44
YEAR?=$(shell date +"%Y")

build/ci.yaml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,15 @@ steps:
3636
on:
3737
- success
3838

39+
prepare_build_secrets:
40+
stage: Prepare
41+
title: 'Prepare build secrets'
42+
image: alpine
43+
commands:
44+
- export GITHUB_TOKEN_PATH=${{CF_VOLUME_PATH}}/GITHUB_TOKEN
45+
- cf_export GITHUB_TOKEN_PATH
46+
- echo $GITHUB_TOKEN > $GITHUB_TOKEN_PATH
47+
3948
compare_versions:
4049
stage: Prepare
4150
title: compare versions
@@ -121,8 +130,9 @@ steps:
121130
buildkit: true
122131
disable_push: true
123132
build_arguments:
124-
- GITHUB_TOKEN=${{GITHUB_TOKEN}}
125133
- SEGMENT_WRITE_KEY=${{SEGMENT_WRITE_KEY}}
134+
secrets:
135+
- id=GITHUB_TOKEN,src=${{GITHUB_TOKEN_PATH}}
126136
when:
127137
condition:
128138
all:
@@ -131,6 +141,9 @@ steps:
131141
- name: compare_versions
132142
on:
133143
- success
144+
- name: prepare_build_secrets
145+
on:
146+
- success
134147

135148
push_dev:
136149
stage: Push Dev

docs/releases/release_notes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ cf version
2323

2424
```bash
2525
# download and extract the binary
26-
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.1.62/cf-linux-amd64.tar.gz | tar zx
26+
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.1.63/cf-linux-amd64.tar.gz | tar zx
2727

2828
# move the binary to your $PATH
2929
mv ./cf-linux-amd64 /usr/local/bin/cf
@@ -36,7 +36,7 @@ cf version
3636

3737
```bash
3838
# download and extract the binary
39-
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.1.62/cf-darwin-amd64.tar.gz | tar zx
39+
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.1.63/cf-darwin-amd64.tar.gz | tar zx
4040

4141
# move the binary to your $PATH
4242
mv ./cf-darwin-amd64 /usr/local/bin/cf

0 commit comments

Comments
 (0)