38
38
- name : Install and configure poetry
39
39
run : |
40
40
pipx install poetry
41
- poetry config virtualenvs.create false
42
41
43
42
- if : github.event.inputs.cluster == 'prod'
44
43
run : |
@@ -51,19 +50,40 @@ jobs:
51
50
- name : Install package
52
51
run : poetry install
53
52
54
- - name : Install jq for fingerprinter
55
- run : sudo apt-get -y install jq
56
-
57
53
- name : Update env with promotion version that was provided
58
54
if : github.event.inputs.version
59
55
run : echo "target_version=${{ github.event.inputs.version }}" >> $GITHUB_ENV
60
56
61
57
- name : Update env with promotion version if not provided
62
58
if : ' ! env.target_version'
59
+ shell : bash
63
60
run : |
64
- source ./scripts/globals.sh
65
- target_version=$(get_promotion_version ${{ github.event.inputs.cluster }})
66
- echo "target_version=${target_version}" >> $GITHUB_ENV
61
+ # $1 will be package name, $2 will be current version
62
+ set $(poetry version)
63
+
64
+ case "${{ github.event.inputs.cluster }}" in
65
+ dev)
66
+ version="$2"
67
+ echo "Would set version to '$version' (from poetry version)"
68
+ ;;
69
+ eval)
70
+ # substitute '_' for '-' in APP_NAME
71
+ url="https://${1//_/-}.iamdev.s.uw.edu/status"
72
+ version=$(curl --silent $url | python -c "import json, sys; print(json.load(sys.stdin)['version'])")
73
+ echo "After consulting dev the eval version will be ${version}"
74
+ ;;
75
+ prod)
76
+ # substitute '_' for '-' in APP_NAME
77
+ url="https://${1//_/-}.iameval.s.uw.edu/status"
78
+ version=$(curl --silent $url | python -c "import json, sys; print(json.load(sys.stdin)['version'])")
79
+ echo "After consulting eval the prod version will be ${version}"
80
+ ;;
81
+ *)
82
+ echo "Invalid cluster! Pick one of dev|eval|prod"
83
+ exit 1
84
+ ;;
85
+ esac
86
+ echo "target_version=${version}" >> $GITHUB_ENV
67
87
68
88
- name : Auth to Google Cloud
69
89
# important! this 'auth' is referenced as `steps.auth` on the next job
@@ -80,10 +100,14 @@ jobs:
80
100
run : |-
81
101
echo '${{ steps.auth.outputs.access_token }}' | docker login -u oauth2accesstoken --password-stdin https://us-docker.pkg.dev
82
102
83
- - name : Deploy version ${{ env.target_version }}
103
+ - name : Tag version ${{ env.target_version }} for ${{ github.event.inputs.cluster }}
84
104
id : deploy
85
105
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 }}
106
+ # timestamp and deploy_tag are not DRY - see also release-on-push-to-main.yaml
107
+ timestamp=$(date --utc +%Y.%m.%d.%H.%M.%S)
108
+ deploy_tag="deploy-${{ github.event.inputs.cluster }}.${timestamp}.v${{ env.target_version }}"
109
+ echo "::notice::Deploying appid version ${{ env.target_version }} to ${{ github.event.inputs.cluster }} as ${deploy_tag}"
110
+ # this will create a new tag (deploy_tag) on an existing tag (env.target_version)
111
+ docker buildx imagetools create \
112
+ --tag us-docker.pkg.dev/uwit-mci-iam/containers/${template:app_name_hyphen}:${deploy_tag} \
113
+ us-docker.pkg.dev/uwit-mci-iam/containers/${template:app_name_hyphen}:${{ env.target_version }}
0 commit comments