@@ -51,19 +51,40 @@ jobs:
51
51
- name : Install package
52
52
run : poetry install
53
53
54
- - name : Install jq for fingerprinter
55
- run : sudo apt-get -y install jq
56
-
57
54
- name : Update env with promotion version that was provided
58
55
if : github.event.inputs.version
59
56
run : echo "target_version=${{ github.event.inputs.version }}" >> $GITHUB_ENV
60
57
61
58
- name : Update env with promotion version if not provided
62
59
if : ' ! env.target_version'
60
+ shell : bash
63
61
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
67
88
68
89
- name : Auth to Google Cloud
69
90
# important! this 'auth' is referenced as `steps.auth` on the next job
@@ -80,10 +101,14 @@ jobs:
80
101
run : |-
81
102
echo '${{ steps.auth.outputs.access_token }}' | docker login -u oauth2accesstoken --password-stdin https://us-docker.pkg.dev
82
103
83
- - name : Deploy version ${{ env.target_version }}
104
+ - name : Tag version ${{ env.target_version }} for ${{ github.event.inputs.cluster }}
84
105
id : deploy
85
106
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