Remove debugging code? @OriHoch #230
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: CI | |
on: | |
push: | |
paths-ignore: | |
- '**.md' | |
jobs: | |
ci: | |
runs-on: ubuntu-20.04 | |
steps: | |
- env: | |
DOCKER_APP_IMAGE_NAME: "ghcr.io/hasadna/knesset-data-pipelines/knesset-data-pipelines-airflow" | |
DOCKER_LEGACY_IMAGE_NAME: "ghcr.io/hasadna/knesset-data-pipelines/knesset-data-pipelines-legacy" | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
K8S_DEPLOY_KEY: ${{ secrets.KNESSET_DATA_K8S_DEPLOY_KEY }} | |
run: | | |
curl -s https://raw.githubusercontent.com/OriHoch/uumpa-ci-toolbox/65a0704332e63d51f63981dbb25cd83682dc4078/bin/github_actions_install.sh \ | |
| bash -s 65a0704332e63d51f63981dbb25cd83682dc4078 OriHoch/uumpa-ci-toolbox &&\ | |
uci github actions self-checkout --config-user-name "knesset-data-pipelines-ci" &&\ | |
uci github actions docker-login &&\ | |
uci docker build-cache \ | |
--cache-from "${DOCKER_LEGACY_IMAGE_NAME}:latest" \ | |
-- -t legacy . &&\ | |
uci docker tag-push \ | |
--source-tag-name legacy \ | |
--push-tag-name "${DOCKER_LEGACY_IMAGE_NAME}:${GITHUB_SHA}" &&\ | |
uci docker build-cache \ | |
--cache-from "${DOCKER_APP_IMAGE_NAME}:latest" \ | |
-- --build-arg KNESSET_DATA_PIPELINES_VERSION="${GITHUB_SHA}" -t app airflow &&\ | |
uci docker tag-push \ | |
--source-tag-name app \ | |
--push-tag-name "${DOCKER_APP_IMAGE_NAME}:${GITHUB_SHA}" &&\ | |
if [ "${GITHUB_REF}" == "refs/heads/master" ]; then | |
docker tag app "${DOCKER_APP_IMAGE_NAME}:latest" &&\ | |
docker push "${DOCKER_APP_IMAGE_NAME}:latest" &&\ | |
docker tag legacy "${DOCKER_LEGACY_IMAGE_NAME}:latest" &&\ | |
docker push "${DOCKER_LEGACY_IMAGE_NAME}:latest" &&\ | |
if ! git log -1 --pretty=format:"%s" | grep -- --no-deploy; then | |
cd `mktemp -d` &&\ | |
echo "${K8S_DEPLOY_KEY}" > k8s_deploy_key &&\ | |
chmod 400 k8s_deploy_key &&\ | |
export GIT_SSH_COMMAND="ssh -i `pwd`/k8s_deploy_key -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" &&\ | |
git clone git@github.com:OriHoch/knesset-data-k8s.git &&\ | |
cd knesset-data-k8s &&\ | |
python update_yaml.py '{"image":"'"${DOCKER_LEGACY_IMAGE_NAME}:${GITHUB_SHA}"'","airflowImage":"'"${DOCKER_APP_IMAGE_NAME}:${GITHUB_SHA}"'"}' apps/pipelines/values-hasadna-auto-updated.yaml &&\ | |
git config --global user.name "Knesset Data Pipelines CI" &&\ | |
git config --global user.email "knesset-data-pipelines-ci@localhost" &&\ | |
git add apps/pipelines/values-hasadna-auto-updated.yaml && git commit -m "automatic update of knesset data pipelines" &&\ | |
git push origin master | |
fi | |
fi |