Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 44 additions & 26 deletions .github/workflows/docker.build.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
name: Docker build

on:
push:
branches:
- 'main'
tags:
- '*'
#push:
# branches:
# - 'main'
#tags:
# - '*'
pull_request:
jobs:
docker-build:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -56,51 +57,68 @@ jobs:
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
#Staging: Create pull request on deploy repo from a merged PR
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- run: pip install -r .github/workflows/requirements.txt
-
name: create pull request for deploy on staging
uses: actions/checkout@v3
# remove this if statement after fixing the PR
if: 1==2
with:
repository: wmde/wbaas-deploy
# Make changes to pull request here
- # TODO: Remove this if statement after fixing the PR
if: 1==2
run: |
get_tag=$(echo ${{ steps.docker_meta.outputs.tags }} | cut -d':' -f2)
yq -i '.image.tag=$get_tag' k8s/helmfile/env/local/ui.values.yaml.gotmpl
yq -i '.image.tag=$get_tag' k8s/helmfile/env/staging/ui.values.yaml.gotmpl
- run: |
export GET_TAG="$(echo ${{ steps.docker_meta.outputs.tags }} | cut -d':' -f2)"
python - <<EOF
from ruamel.yaml import YAML
import sys
import os

yaml=YAML()
with open("k8s/helmfile/env/local/ui.values.yaml.gotmpl") as doc:
data=yaml.load(doc)
data['image']['tag']=os.environ[GET_TAG]
with open("k8s/helmfile/env/local/ui.values.yaml.gotmpl", 'w') as doc:
yaml.dump(data, doc)
with open("k8s/helmfile/env/staging/ui.values.yaml.gotmpl") as doc:
data=yaml.load(doc)
data['image']['tag']=os.environ[GET_TAG]
with open("k8s/helmfile/env/staging/ui.values.yaml.gotmpl", 'w') as doc:
yaml.dump(data, doc)
EOF
- uses: peter-evans/create-pull-request@v4
# TODO: Remove this if statement after fixing the PR
if: 1==2
with:
commit-message: 'Staging+Local: Deploy new UI image ${{ steps.docker_meta.outputs.tags }}'
title: 'Staging+Local: Deploy new UI image ${{ steps.docker_meta.outputs.tags }}'
branch: deploy-to-staging-${{env.GITHUB_RUN_ID}}
branch: deploy-to-staging-$GITHUB_RUN_ID
committer: wmdebot <github-bots@wikimedia.de>
author: ${{ github.actor }} <github-bots@wikimedia.de>
labels: automated pr
token: ${{ secrets.WBAAS_DEPLOY_TOKEN }}
#Production: Create pull request on deploy repo from a merged PR
- name: create pull request for deploy on production
uses: actions/checkout@v3
# remove this if statement after fixing the PR
if: 1==2
with:
repository: wmde/wbaas-deploy
# Make changes to pull request here
- # TODO: Remove this if statement after fixing the PR
if: 1==2
run: |
get_tag=$(echo ${{ steps.docker_meta.outputs.tags }} | cut -d':' -f2)
yq -i '.image.tag=$get_tag' k8s/helmfile/env/production/ui.values.yaml.gotmpl
- run: |
python - <<EOF
from ruamel.yaml import YAML
import sys

yaml=YAML()
with open("k8s/helmfile/env/production/ui.values.yaml.gotmpl") as doc:
data=yaml.load(doc)
data['image']['tag']="sha-"+$GITHUB_SHA[:7]
with open("k8s/helmfile/env/production/ui.values.yaml.gotmpl", 'w') as doc:
yaml.dump(data, doc)
EOF
- uses: peter-evans/create-pull-request@v4
# TODO: Remove this if statement after fixing the PR
if: 1==2
with:
commit-message: 'Production: Deploy new UI image ${{ steps.docker_meta.outputs.tags }}'
title: 'Production: Deploy new UI image ${{ steps.docker_meta.outputs.tags }}'
branch: deploy-to-production-${{env.GITHUB_RUN_ID}}
branch: deploy-to-production-$GITHUB_RUN_ID
committer: wmdebot <github-bots@wikimedia.de>
author: ${{ github.actor }} <github-bots@wikimedia.de>
labels: automated pr
Expand Down