Skip to content

Commit a5fcbf6

Browse files
committed
Adding support for specifying namespace when deploying images to a docker repository
1 parent 2ade8d8 commit a5fcbf6

File tree

6 files changed

+16
-6
lines changed

6 files changed

+16
-6
lines changed

.github/workflows/actions/build-deploy-images/action.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ inputs:
1010
required: true
1111
docker-password:
1212
required: true
13+
docker-namespace:
14+
required: false
1315
runs:
1416
using: 'composite'
1517
steps:
@@ -22,4 +24,5 @@ runs:
2224
docker-push-tag: ${{ inputs.docker-push-tag }}
2325
docker-username: ${{ inputs.docker-username }}
2426
docker-password: ${{ inputs.docker-password }}
25-
docker-host: ${{ inputs.docker-host }}
27+
docker-host: ${{ inputs.docker-host }}
28+
docker-namespace: ${{ inputs.docker-namespace }}

.github/workflows/actions/docker-images-deploy/action.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ inputs:
1010
required: true
1111
docker-password:
1212
required: true
13+
docker-namespace:
14+
required: false
1315
runs:
1416
using: 'composite'
1517
steps:
@@ -20,5 +22,6 @@ runs:
2022
"${{ inputs.docker-push-tag }}" \
2123
"${{ inputs.docker-host }}" \
2224
"${{ inputs.docker-username }}" \
23-
"${{ inputs.docker-password }}"
25+
"${{ inputs.docker-password }}" \
26+
"${{ inputs.docker-namespace || 'jembi' }}"
2427
shell: bash

.github/workflows/actions/docker-images-deploy/deployDockerImages.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ push_tag=$2
55
registry_url=$3
66
username=$4
77
password=$5
8+
namespace=$6
89

910
if [ -z "$registry_url" ] || [ -z "$username" ] || [ -z "$password" ]; then
1011
echo "Docker host details not set. Skipping deploying"
@@ -26,7 +27,7 @@ IMAGE_LIST=$(docker image ls --filter "reference=*:$original_tag" --format "{{.R
2627

2728
for IMAGE in $IMAGE_LIST; do
2829
IFS=':' read -a image_details <<< "$IMAGE"
29-
push_tag_url="$registry_url/$username/${image_details[0]}:$push_tag"
30+
push_tag_url="$registry_url/$namespace/${image_details[0]}:$push_tag"
3031

3132
echo "Pushing image: $IMAGE to '$push_tag_url'"
3233

.github/workflows/deploy-images-dockerhub.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,5 @@ jobs:
5151
docker-push-tag: ${{ steps.validate-tag.outputs.docker-push-tag }}
5252
docker-host: "docker.io"
5353
docker-username: ${{ secrets.DOCKER_HUB_USER_NAME }}
54-
docker-password: ${{ secrets.DOCKER_HUB_PASSWORD }}
54+
docker-password: ${{ secrets.DOCKER_HUB_PASSWORD }}
55+
docker-namespace: ${{ vars.DOCKER_HUB_NAMESPACE }}

.github/workflows/entry-on-merge.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,5 @@ jobs:
3636
image-build-tag: ${{ steps.get-image-build-tag.outputs.image-build-tag }}
3737
docker-host: ${{ vars.DOCKER_LOCAL_HOST_NAME }}
3838
docker-username: ${{ secrets.DOCKER_LOCAL_USER_NAME }}
39-
docker-password: ${{ secrets.DOCKER_LOCAL_PASSWORD }}
39+
docker-password: ${{ secrets.DOCKER_LOCAL_PASSWORD }}
40+
docker-namespace: ${{ vars.DOCKER_LOCAL_NAMESPACE }}

.github/workflows/entry-on-release.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,5 @@ jobs:
3636
docker-push-tag: ${{ steps.validate-tag.outputs.docker-push-tag }}
3737
docker-host: "docker.io"
3838
docker-username: ${{ secrets.DOCKER_HUB_USER_NAME }}
39-
docker-password: ${{ secrets.DOCKER_HUB_PASSWORD }}
39+
docker-password: ${{ secrets.DOCKER_HUB_PASSWORD }}
40+
docker-namespace: ${{ vars.DOCKER_HUB_NAMESPACE }}

0 commit comments

Comments
 (0)