Skip to content

Commit f586922

Browse files
committed
Update deploy template to not rely on fingerprinter
1 parent d3320fa commit f586922

File tree

1 file changed

+36
-11
lines changed

1 file changed

+36
-11
lines changed

.github/workflows/deploy.template.yml

+36-11
Original file line numberDiff line numberDiff line change
@@ -51,19 +51,40 @@ jobs:
5151
- name: Install package
5252
run: poetry install
5353

54-
- name: Install jq for fingerprinter
55-
run: sudo apt-get -y install jq
56-
5754
- name: Update env with promotion version that was provided
5855
if: github.event.inputs.version
5956
run: echo "target_version=${{ github.event.inputs.version }}" >> $GITHUB_ENV
6057

6158
- name: Update env with promotion version if not provided
6259
if: '! env.target_version'
60+
shell: bash
6361
run: |
64-
source ./scripts/globals.sh
65-
target_version=$(get_promotion_version ${{ github.event.inputs.cluster }})
66-
echo "target_version=${target_version}" >> $GITHUB_ENV
62+
# $1 will be package name, $2 will be current version
63+
set $(poetry version)
64+
65+
case "${{ github.event.inputs.cluster }}" in
66+
dev)
67+
version="$2"
68+
echo "Would set version to '$version' (from poetry version)"
69+
;;
70+
eval)
71+
# substitute '_' for '-' in APP_NAME
72+
url="https://${1//_/-}.iamdev.s.uw.edu/status"
73+
version=$(curl --silent $url | python -c "import json, sys; print(json.load(sys.stdin)['version'])")
74+
echo "After consulting dev the eval version will be ${version}"
75+
;;
76+
prod)
77+
# substitute '_' for '-' in APP_NAME
78+
url="https://${1//_/-}.iameval.s.uw.edu/status"
79+
version=$(curl --silent $url | python -c "import json, sys; print(json.load(sys.stdin)['version'])")
80+
echo "After consulting eval the prod version will be ${version}"
81+
;;
82+
*)
83+
echo "Invalid cluster! Pick one of dev|eval|prod"
84+
exit 1
85+
;;
86+
esac
87+
echo "target_version=${version}" >> $GITHUB_ENV
6788
6889
- name: Auth to Google Cloud
6990
# important! this 'auth' is referenced as `steps.auth` on the next job
@@ -80,10 +101,14 @@ jobs:
80101
run: |-
81102
echo '${{ steps.auth.outputs.access_token }}' | docker login -u oauth2accesstoken --password-stdin https://us-docker.pkg.dev
82103
83-
- name: Deploy version ${{ env.target_version }}
104+
- name: Tag version ${{ env.target_version }} for ${{ github.event.inputs.cluster }}
84105
id: deploy
85106
run: |
86-
echo "::notice::Deploying appid version ${{ env.target_version }} to ${{ github.event.inputs.cluster }}"
87-
./scripts/build.sh \
88-
--deploy ${{ inputs.cluster }} \
89-
-dversion ${{ env.target_version }}
107+
# timestamp and deploy_tag are not DRY - see also release-on-push-to-main.yaml
108+
timestamp=$(date --utc +%Y.%m.%d.%H.%M.%S)
109+
deploy_tag="deploy-${{ github.event.inputs.cluster }}.${timestamp}.v${{ env.target_version }}"
110+
echo "::notice::Deploying appid version ${{ env.target_version }} to ${{ github.event.inputs.cluster }} as ${deploy_tag}"
111+
# this will create a new tag (deploy_tag) on an existing tag (env.target_version)
112+
docker buildx imagetools create \
113+
--tag us-docker.pkg.dev/uwit-mci-iam/containers/${template:app_name_hyphen}:${deploy_tag} \
114+
us-docker.pkg.dev/uwit-mci-iam/containers/${template:app_name_hyphen}:${{ env.target_version }}

0 commit comments

Comments
 (0)