Merge pull request #1751 from AgID/develop #72
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish pre-release portal image | |
on: | |
push: | |
branches: [master] | |
env: | |
PHP_VERSION: 7.4 | |
IMAGE_TAG: latest | |
IMAGE_NAME: wai-portal | |
ORGANIZATION: webanalyticsitalia | |
K8S_CLIENT_CERT: ${{ secrets.K8S_CLIENT_CERT }} | |
K8S_CLIENT_KEY: ${{ secrets.K8S_CLIENT_KEY }} | |
jobs: | |
build: | |
environment: Staging | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Prepare files | |
if: success() | |
run: cp ${{ github.workspace }}/containers/queue-worker/supervisord.conf ${{ github.workspace }} | |
- name: Build image | |
if: success() | |
run: docker build --no-cache --rm -f ${{ github.workspace }}/Dockerfile.portal --build-arg PHP_VERSION=$PHP_VERSION -t $ORGANIZATION/$IMAGE_NAME:$IMAGE_TAG ${{ github.workspace }} | |
- name: Push image | |
if: success() | |
run: | | |
echo ${{ secrets.DOCKER_HUB_TOKEN }} | docker login --username ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin | |
docker push $ORGANIZATION/$IMAGE_NAME:$IMAGE_TAG | |
- name: Docker logout | |
if: always() | |
run: docker logout | |
- name: Trigger portal rolling update in staging environment | |
if: success() | |
run: | | |
curl -X PATCH \ | |
--silent \ | |
--output /dev/null \ | |
--cert <(echo "$K8S_CLIENT_CERT") \ | |
--key <(echo "$K8S_CLIENT_KEY") \ | |
-d @- \ | |
-H 'Accept: application/json' \ | |
-H 'Content-Type: application/json-patch+json' \ | |
https://k8s.webanalytics.italia.it/apis/apps/v1/namespaces/wai-stag/deployments/portal <<EOF | |
[ | |
{ "op": "replace", "path": "/spec/template/metadata/annotations/releaseDate", "value": "d$(date +%Y%m%d%H%M)" } | |
] | |
EOF | |
- name: Trigger portal-queue-worker rolling update in staging environment | |
if: success() | |
run: | | |
curl -X PATCH \ | |
--silent \ | |
--output /dev/null \ | |
--cert <(echo "$K8S_CLIENT_CERT") \ | |
--key <(echo "$K8S_CLIENT_KEY") \ | |
-d @- \ | |
-H 'Accept: application/json' \ | |
-H 'Content-Type: application/json-patch+json' \ | |
https://k8s.webanalytics.italia.it/apis/apps/v1/namespaces/wai-stag/deployments/portal-queue-worker <<EOF | |
[ | |
{ "op": "replace", "path": "/spec/template/metadata/annotations/releaseDate", "value": "d$(date +%Y%m%d%H%M)" } | |
] | |
EOF | |
- name: Trigger portal-scheduler rolling update in staging environment | |
if: success() | |
run: | | |
curl -X PATCH \ | |
--silent \ | |
--output /dev/null \ | |
--cert <(echo "$K8S_CLIENT_CERT") \ | |
--key <(echo "$K8S_CLIENT_KEY") \ | |
-d @- \ | |
-H 'Accept: application/json' \ | |
-H 'Content-Type: application/json-patch+json' \ | |
https://k8s.webanalytics.italia.it/apis/apps/v1/namespaces/wai-stag/deployments/portal-scheduler <<EOF | |
[ | |
{ "op": "replace", "path": "/spec/template/metadata/annotations/releaseDate", "value": "d$(date +%Y%m%d%H%M)" } | |
] | |
EOF |