Skip to content

Commit 788a70f

Browse files
committed
Add GITHUB_AUTH_TOKEN as arg to Dockerfile to RUN commands using phive
1 parent b0bb50f commit 788a70f

12 files changed

+37
-10
lines changed

.automation/upload-docker.sh

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
###########
1818
# Globals #
1919
###########
20+
GITHUB_AUTH_TOKEN="${GITHUB_AUTH_TOKEN}" # GitHub Token
2021
GITHUB_WORKSPACE="${GITHUB_WORKSPACE}" # GitHub Workspace
2122
GITHUB_REPOSITORY="${GITHUB_REPOSITORY}" # GitHub Org/Repo passed from system
2223
DOCKER_USERNAME="${DOCKER_USERNAME}" # Username to login to DockerHub
@@ -316,7 +317,7 @@ BuildImage() {
316317
###################
317318
# Build the image #
318319
###################
319-
docker buildx build --platform "${DOCKER_BUILD_PLATFORMS}" $EXTRA_DOCKER_BUILD_ARGS --no-cache --build-arg "BUILD_DATE=${BUILD_DATE}" --build-arg "BUILD_REVISION=${BUILD_REVISION}" --build-arg "BUILD_VERSION=${BUILD_VERSION}" -t "${CONTAINER_URL}:${IMAGE_VERSION}" -f "${DOCKERFILE_PATH}" --load . 2>&1
320+
docker buildx build --platform "${DOCKER_BUILD_PLATFORMS}" $EXTRA_DOCKER_BUILD_ARGS --no-cache --build-arg "GITHUB_AUTH_TOKEN=${GITHUB_AUTH_TOKEN}" --build-arg "BUILD_DATE=${BUILD_DATE}" --build-arg "BUILD_REVISION=${BUILD_REVISION}" --build-arg "BUILD_VERSION=${BUILD_VERSION}" -t "${CONTAINER_URL}:${IMAGE_VERSION}" -f "${DOCKERFILE_PATH}" --load . 2>&1
320321

321322
#######################
322323
# Load the error code #
@@ -341,8 +342,8 @@ BuildImage() {
341342
# docker tag "${CONTAINER_URL}:${IMAGE_VERSION}" "${CONTAINER_URL}:latest"
342343

343344
# Tag the image with the major tag & latest tag as well
344-
docker buildx build --platform "${DOCKER_BUILD_PLATFORMS}" $EXTRA_DOCKER_BUILD_ARGS --build-arg "BUILD_DATE=${BUILD_DATE}" --build-arg "BUILD_REVISION=${BUILD_REVISION}" --build-arg "BUILD_VERSION=${MAJOR_TAG}" -t "${CONTAINER_URL}:latest" -f "${DOCKERFILE_PATH}" --load . 2>&1
345-
docker buildx build --platform "${DOCKER_BUILD_PLATFORMS}" $EXTRA_DOCKER_BUILD_ARGS --build-arg "BUILD_DATE=${BUILD_DATE}" --build-arg "BUILD_REVISION=${BUILD_REVISION}" --build-arg "BUILD_VERSION=${MAJOR_TAG}" -t "${CONTAINER_URL}:${MAJOR_TAG}" -f "${DOCKERFILE_PATH}" --load . 2>&1
345+
docker buildx build --platform "${DOCKER_BUILD_PLATFORMS}" $EXTRA_DOCKER_BUILD_ARGS --build-arg "GITHUB_AUTH_TOKEN=${GITHUB_AUTH_TOKEN}" --build-arg "BUILD_DATE=${BUILD_DATE}" --build-arg "BUILD_REVISION=${BUILD_REVISION}" --build-arg "BUILD_VERSION=${MAJOR_TAG}" -t "${CONTAINER_URL}:latest" -f "${DOCKERFILE_PATH}" --load . 2>&1
346+
docker buildx build --platform "${DOCKER_BUILD_PLATFORMS}" $EXTRA_DOCKER_BUILD_ARGS --build-arg "GITHUB_AUTH_TOKEN=${GITHUB_AUTH_TOKEN}" --build-arg "BUILD_DATE=${BUILD_DATE}" --build-arg "BUILD_REVISION=${BUILD_REVISION}" --build-arg "BUILD_VERSION=${MAJOR_TAG}" -t "${CONTAINER_URL}:${MAJOR_TAG}" -f "${DOCKERFILE_PATH}" --load . 2>&1
346347

347348
#######################
348349
# Load the error code #
@@ -378,7 +379,7 @@ BuildImage() {
378379
###################
379380
# Build the image #
380381
###################
381-
docker buildx build --platform "${DOCKER_BUILD_PLATFORMS}" $EXTRA_DOCKER_BUILD_ARGS --build-arg "BUILD_DATE=${BUILD_DATE}" --build-arg "BUILD_REVISION=${BUILD_REVISION}" --build-arg "BUILD_VERSION=${BUILD_VERSION}" -t "${ADDITIONAL_URL}:${IMAGE_VERSION}" -f "${DOCKERFILE_PATH}" --load . 2>&1
382+
docker buildx build --platform "${DOCKER_BUILD_PLATFORMS}" $EXTRA_DOCKER_BUILD_ARGS --build-arg "GITHUB_AUTH_TOKEN=${GITHUB_AUTH_TOKEN}" --build-arg "BUILD_DATE=${BUILD_DATE}" --build-arg "BUILD_REVISION=${BUILD_REVISION}" --build-arg "BUILD_VERSION=${BUILD_VERSION}" -t "${ADDITIONAL_URL}:${IMAGE_VERSION}" -f "${DOCKERFILE_PATH}" --load . 2>&1
382383

383384
#######################
384385
# Load the error code #
@@ -403,8 +404,8 @@ BuildImage() {
403404
###################
404405
# Build the image with latest tags#
405406
###################
406-
docker buildx build --platform "${DOCKER_BUILD_PLATFORMS}" $EXTRA_DOCKER_BUILD_ARGS --build-arg "BUILD_DATE=${BUILD_DATE}" --build-arg "BUILD_REVISION=${BUILD_REVISION}" --build-arg "BUILD_VERSION=${MAJOR_TAG}" -t "${ADDITIONAL_URL}:latest" -f "${DOCKERFILE_PATH}" . --load 2>&1
407-
docker buildx build --platform "${DOCKER_BUILD_PLATFORMS}" $EXTRA_DOCKER_BUILD_ARGS --build-arg "BUILD_DATE=${BUILD_DATE}" --build-arg "BUILD_REVISION=${BUILD_REVISION}" --build-arg "BUILD_VERSION=${MAJOR_TAG}" -t "${ADDITIONAL_URL}:${MAJOR_TAG}" -f "${DOCKERFILE_PATH}" . --load 2>&1
407+
docker buildx build --platform "${DOCKER_BUILD_PLATFORMS}" $EXTRA_DOCKER_BUILD_ARGS --build-arg "GITHUB_AUTH_TOKEN=${GITHUB_AUTH_TOKEN}" --build-arg "BUILD_DATE=${BUILD_DATE}" --build-arg "BUILD_REVISION=${BUILD_REVISION}" --build-arg "BUILD_VERSION=${MAJOR_TAG}" -t "${ADDITIONAL_URL}:latest" -f "${DOCKERFILE_PATH}" . --load 2>&1
408+
docker buildx build --platform "${DOCKER_BUILD_PLATFORMS}" $EXTRA_DOCKER_BUILD_ARGS --build-arg "GITHUB_AUTH_TOKEN=${GITHUB_AUTH_TOKEN}" --build-arg "BUILD_DATE=${BUILD_DATE}" --build-arg "BUILD_REVISION=${BUILD_REVISION}" --build-arg "BUILD_VERSION=${MAJOR_TAG}" -t "${ADDITIONAL_URL}:${MAJOR_TAG}" -f "${DOCKERFILE_PATH}" . --load 2>&1
408409

409410
#######################
410411
# Load the error code #

.github/workflows/deploy-ALPHA-flavors.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ jobs:
8484
- name: Deploy latest image to DockerHub
8585
env:
8686
# Set the Env Vars
87+
GITHUB_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8788
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
8889
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
8990
IMAGE_REPO: oxsecurity/megalinter-${{ matrix.flavor }}
@@ -101,6 +102,7 @@ jobs:
101102
- name: Deploy latest image to GitHub Container Registry
102103
env:
103104
# Set the Env Vars
105+
GITHUB_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
104106
GCR_USERNAME: ${{ secrets.GCR_USERNAME }}
105107
GCR_TOKEN: ${{ secrets.GCR_PASSWORD }}
106108
IMAGE_REPO: oxsecurity/megalinter-${{ matrix.flavor }}

.github/workflows/deploy-ALPHA.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ jobs:
6464
- name: Deploy latest image to DockerHub
6565
env:
6666
# Set the Env Vars
67+
GITHUB_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6768
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
6869
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
6970
IMAGE_REPO: oxsecurity/megalinter
@@ -81,6 +82,7 @@ jobs:
8182
if: github.repository == 'disabled'
8283
env:
8384
# Set the Env Vars
85+
GITHUB_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8486
GCR_USERNAME: ${{ secrets.GCR_USERNAME }}
8587
GCR_TOKEN: ${{ secrets.GCR_PASSWORD }}
8688
IMAGE_REPO: oxsecurity/megalinter

.github/workflows/deploy-BETA-flavors.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ jobs:
8888
- name: Deploy beta image to DockerHub
8989
env:
9090
# Set the Env Vars
91+
GITHUB_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9192
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
9293
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
9394
IMAGE_REPO: oxsecurity/megalinter-${{ matrix.flavor }}
@@ -104,6 +105,7 @@ jobs:
104105
- name: Deploy beta image to GitHub Container Registry
105106
env:
106107
# Set the Env Vars
108+
GITHUB_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
107109
GCR_USERNAME: ${{ secrets.GCR_USERNAME }}
108110
GCR_TOKEN: ${{ secrets.GCR_PASSWORD }}
109111
IMAGE_REPO: oxsecurity/megalinter-${{ matrix.flavor }}

.github/workflows/deploy-BETA-linters.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ jobs:
115115
- name: Deploy Beta image to DockerHub
116116
env:
117117
# Set the Env Vars
118+
GITHUB_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
118119
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
119120
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
120121
IMAGE_REPO: oxsecurity/megalinter-only-${{ matrix.linter }}
@@ -128,6 +129,7 @@ jobs:
128129
- name: Deploy ${{ needs.prepare.outputs.unique_docker_image_name }} image to DockerHub
129130
env:
130131
# Set the Env Vars
132+
GITHUB_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
131133
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
132134
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
133135
IMAGE_REPO: oxsecurity/megalinter-only-${{ matrix.linter }}
@@ -145,6 +147,7 @@ jobs:
145147
- name: Deploy Beta image to GitHub Container Registry
146148
env:
147149
# Set the Env Vars
150+
GITHUB_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
148151
GCR_USERNAME: ${{ secrets.GCR_USERNAME }}
149152
GCR_TOKEN: ${{ secrets.GCR_PASSWORD }}
150153
IMAGE_REPO: oxsecurity/megalinter-only-${{ matrix.linter }}
@@ -158,6 +161,7 @@ jobs:
158161
- name: Deploy ${{ needs.prepare.outputs.unique_docker_image_name }} image to GitHub Container Registry
159162
env:
160163
# Set the Env Vars
164+
GITHUB_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
161165
GCR_USERNAME: ${{ secrets.GCR_USERNAME }}
162166
GCR_TOKEN: ${{ secrets.GCR_PASSWORD }}
163167
IMAGE_REPO: oxsecurity/megalinter-only-${{ matrix.linter }}

.github/workflows/deploy-BETA.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ jobs:
7777
- name: Deploy beta image to DockerHub
7878
env:
7979
# Set the Env Vars
80+
GITHUB_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8081
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
8182
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
8283
IMAGE_REPO: oxsecurity/megalinter
@@ -93,6 +94,7 @@ jobs:
9394
- name: Deploy beta image to GitHub Container Registry
9495
env:
9596
# Set the Env Vars
97+
GITHUB_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9698
GCR_USERNAME: ${{ secrets.GCR_USERNAME }}
9799
GCR_TOKEN: ${{ secrets.GCR_PASSWORD }}
98100
IMAGE_REPO: oxsecurity/megalinter

.github/workflows/deploy-DEV-linters.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ jobs:
108108
- name: Deploy ${{ needs.prepare.outputs.tag }} image to DockerHub
109109
env:
110110
# Set the Env Vars
111+
GITHUB_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
111112
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
112113
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
113114
IMAGE_REPO: oxsecurity/megalinter-only-${{ matrix.linter }}

.github/workflows/deploy-DEV.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ jobs:
104104
if: "contains(github.event.head_commit.message, 'quick build push')"
105105
env:
106106
# Set the Env Vars
107+
GITHUB_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
107108
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
108109
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
109110
IMAGE_REPO: oxsecurity/megalinter
@@ -143,6 +144,7 @@ jobs:
143144
!contains(github.event.head_commit.message, 'quick build')
144145
env:
145146
# Set the Env Vars
147+
GITHUB_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
146148
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
147149
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
148150
IMAGE_REPO: oxsecurity/megalinter

.github/workflows/deploy-RELEASE-flavors.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ jobs:
7777
- name: Deploy Release image to Dockerhub
7878
env:
7979
# Set the Env Vars
80+
GITHUB_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8081
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
8182
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
8283
IMAGE_REPO: oxsecurity/megalinter-${{ matrix.flavor }}
@@ -93,6 +94,7 @@ jobs:
9394
- name: Deploy Release image to GitHub Container Registry
9495
env:
9596
# Set the Env Vars
97+
GITHUB_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9698
GCR_USERNAME: ${{ secrets.GCR_USERNAME }}
9799
GCR_TOKEN: ${{ secrets.GCR_PASSWORD }}
98100
IMAGE_REPO: oxsecurity/megalinter-${{ matrix.flavor }}

.github/workflows/deploy-RELEASE-linters.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ jobs:
9191
- name: Deploy ${{ github.event.release.tag_name }} image to DockerHub
9292
env:
9393
# Set the Env Vars
94+
GITHUB_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9495
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
9596
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
9697
IMAGE_REPO: oxsecurity/megalinter-only-${{ matrix.linter }}
@@ -108,6 +109,7 @@ jobs:
108109
- name: Deploy ${{ github.event.release.tag_name }} image to GitHub Container Registry
109110
env:
110111
# Set the Env Vars
112+
GITHUB_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
111113
GCR_USERNAME: ${{ secrets.GCR_USERNAME }}
112114
GCR_TOKEN: ${{ secrets.GCR_PASSWORD }}
113115
IMAGE_REPO: oxsecurity/megalinter-only-${{ matrix.linter }}

0 commit comments

Comments
 (0)