Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions dockerfiles/git-image-updater/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ RUN apt-get update \
&& rm /tmp/gh-cli.tar.gz \
&& rm -rf /var/lib/apt/lists/*

COPY genegraph_bumper.sh /usr/local/bin/genegraph_bumper.sh

ENTRYPOINT ["/bin/bash"]
31 changes: 31 additions & 0 deletions dockerfiles/git-image-updater/genegraph_bumper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env bash

# invocation: ./genegraph_bumper.sh genegraph abcdef1 "./helm/values/genegraph/values-stage.yaml,./helm/values/genegraph/values-prod.yaml"
set -euo pipefail

GENEGRAPH_DEPLOYMENT=$1
COMMIT_SHA=$2
UPDATE_FILES_LIST=$3
IFS="," read -ra UPDATE_FILES <<< "$UPDATE_FILES_LIST"
SHORT_SHA=${COMMIT_SHA:0:7}

# retrieve the architecture repo and check out a branch
git clone https://clingen-ci:[email protected]/clingen-data-model/architecture
cd architecture
git checkout -b image-update-$GENEGRAPH_DEPLOYMENT-$SHORT_SHA # TODO: this needs to be more specific

# generate a datestamp
date "+%Y-%m-%dT%H%M" > /tmp/DATETIME.txt

# for every file in UPDATE_FILES, update the image tag and data version
for filename in "${UPDATE_FILES[@]}"
do
/usr/bin/yq eval -i ".genegraph_docker_image_tag = \"$COMMIT_SHA\"" $filename
/usr/bin/yq eval -i ".genegraph_data_version = \"$(tr -d '\n' < /tmp/DATETIME.txt)\"" $filename
done

# commit the changes
git add -u
git -c user.name="Clingen CI Automation" -c user.email="[email protected]" commit -m "bumping docker image for ${GENEGRAPH_DEPLOYMENT}"
git push origin image-update-$GENEGRAPH_DEPLOYMENT-$SHORT_SHA
gh pr create --fill -l automation