Skip to content

Commit

Permalink
add labels to docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
achrefbensaad committed Nov 14, 2022
1 parent 4353c49 commit 78aad3d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/latest-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:

- name: Push discovery engine images to Docker
run: |
./src/build/push_knoxautopolicy.sh ${{ steps.vars.outputs.tag }}
GITHUB_SHA=$GITHUB_SHA ./src/build/push_knoxautopolicy.sh ${{ steps.vars.outputs.tag }}
push-stable-version:
name: Create discovery engine Release - 20.04
Expand Down Expand Up @@ -99,5 +99,5 @@ jobs:

- name: Push discovery engine images to Docker
if: steps.match.outputs.tag == 'true'
run: ./src/build/push_knoxautopolicy.sh stable
run: GITHUB_SHA=$GITHUB_SHA STABLE_VERSION=$(cat STABLE-RELEASE) ./src/build/push_knoxautopolicy.sh stable

2 changes: 1 addition & 1 deletion .github/workflows/stable-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ jobs:
platforms: linux/amd64,linux/arm64/v8

- name: Push discovery engine images to Docker
run: ./src/build/push_knoxautopolicy.sh stable
run: GITHUB_SHA=$GITHUB_SHA STABLE_VERSION=$(cat STABLE-RELEASE) ./src/build/push_knoxautopolicy.sh stable
8 changes: 7 additions & 1 deletion src/build/push_knoxautopolicy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ AUTOPOL_SRC_HOME=$AUTOPOL_HOME/src
[[ "$PLATFORMS" == "" ]] && PLATFORMS="linux/amd64"
#[[ "$PLATFORMS" == "" ]] && PLATFORMS="linux/amd64,linux/arm64/v8"

[[ "$STABLE_VERSION" != "" ]] && STABLE_LABEL="--label stable-version=$STABLE_VERSION"

# set LABEL
unset LABEL
[[ "$GITHUB_SHA" != "" ]] && LABEL="--label github_sha=$GITHUB_SHA"

# check version
VERSION=`git rev-parse --abbrev-ref HEAD`

Expand All @@ -16,7 +22,7 @@ if [ ! -z $1 ]; then
fi

echo "[INFO] Pushing $REPO:$VERSION"
docker buildx build --platform $PLATFORMS --push -t $REPO:$VERSION -f $AUTOPOL_SRC_HOME/build/Dockerfile.autopol .
docker buildx build --platform $PLATFORMS --push -t $REPO:$VERSION -f $AUTOPOL_SRC_HOME/build/Dockerfile.autopol $STABLE_VERSION $LABEL .

if [ $? != 0 ]; then
echo "[FAILED] Failed to push $REPO:$VERSION"
Expand Down

0 comments on commit 78aad3d

Please sign in to comment.