Skip to content

Commit

Permalink
fix: sed quoting in edit_dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
andhreljaKern committed Dec 12, 2024
1 parent cd74adf commit 7d71467
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/pi_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
RELEASE_IMAGE="${{ env.DOCKERHUB_CONTAINER_REGISTRY }}/${{ env.PARENT_IMAGE_NAME }}:${{ github.event.release.tag_name }}-${{ matrix.parent_image_type }}"
BASE_REF="dev"
HEAD_REF="parent-images"
PR_TITLE="ci(pi): update to $RELEASE_IMAGE"
PR_TITLE="ci(pi): $RELEASE_IMAGE"
git branch -D "$HEAD_REF" || true
git checkout -b "$HEAD_REF"
Expand All @@ -75,7 +75,7 @@ jobs:
bash cicd-deployment-scripts/pi/pr_create.sh \
-b "$BASE_REF" \
-h "$HEAD_REF" \
-t "ci(pi): update to $RELEASE_IMAGE" \
-t "$PR_TITLE" \
-o ${{ github.repository_owner }} \
-r ${{ github.event.repository.name }} \
-n ${{ github.event.release.tag_name }} \
Expand Down
12 changes: 6 additions & 6 deletions pi/edit_dockerfile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
set -e

PARENT_IMAGE_NAME="refinery-parent-images"
PARENT_IMAGE_TYPE=""
RELEASE_TAG=""
PARENT_IMAGE_TYPE="common"
RELEASE_TAG="v1.19.1"
DOCKER_REGISTRY="kernai"
DOCKERFILE_PATH="Dockerfile"
DOCKERFILE="Dockerfile"

while getopts i:t:l:r:d: flag
do
Expand All @@ -15,13 +15,13 @@ do
t) PARENT_IMAGE_TYPE=$(echo ${OPTARG} | sed 's|_|-|g');;
l) RELEASE_TAG=${OPTARG};;
r) DOCKER_REGISTRY=${OPTARG};;
d) DOCKERFILE_PATH=${OPTARG};;
d) DOCKERFILE=${OPTARG};;
esac
done

PI_EXISTING_TAG=$(grep "${DOCKER_REGISTRY}/${PARENT_IMAGE_NAME}:v.*-${PARENT_IMAGE_TYPE}" $DOCKERFILE_PATH | sed 's|FROM ||g' | cut -d ':' -f 2)
PI_EXISTING_TAG=$(grep "${DOCKER_REGISTRY}/${PARENT_IMAGE_NAME}:v.*-${PARENT_IMAGE_TYPE}" $DOCKERFILE | sed 's|FROM ||g' | cut -d ':' -f 2)
PI_EXISTING_IMAGE="${DOCKER_REGISTRY}/${PARENT_IMAGE_NAME}:${PI_EXISTING_TAG}"
PI_NEW_IMAGE="${DOCKER_REGISTRY}/${PARENT_IMAGE_NAME}:${RELEASE_TAG}-${PARENT_IMAGE_TYPE}"

echo "$(sed "s|${PI_EXISTING_IMAGE}|${PI_NEW_IMAGE}|g" ${DOCKERFILE_PATH})" > $DOCKERFILE_PATH
echo "$(sed 's|'${PI_EXISTING_IMAGE}'|'${PI_NEW_IMAGE}'|g' ${DOCKERFILE})" > $DOCKERFILE
echo "::notice::Dockerfile updated with new image: ${PI_NEW_IMAGE}"

0 comments on commit 7d71467

Please sign in to comment.