Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/deploy afn k8s #41

Merged
merged 32 commits into from
Mar 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
8deae52
work on pr_afn_k8s
julsemaan Mar 23, 2024
01c6e46
work on pr_afn_k8s
julsemaan Mar 23, 2024
790c9cc
work on pr_afn_k8s
julsemaan Mar 23, 2024
2670126
work on pr_afn_k8s
julsemaan Mar 23, 2024
76d5ac1
work on pr_afn_k8s
julsemaan Mar 23, 2024
7fe6ca9
work on pr_afn_k8s
julsemaan Mar 23, 2024
1f9f98e
work on pr_afn_k8s
julsemaan Mar 23, 2024
bc8f380
work on pr_afn_k8s
julsemaan Mar 23, 2024
af081a0
work on pr_afn_k8s
julsemaan Mar 23, 2024
d602738
work on pr_afn_k8s
julsemaan Mar 23, 2024
a2fc955
work on pr_afn_k8s
julsemaan Mar 23, 2024
1dcae5a
work on pr_afn_k8s
julsemaan Mar 23, 2024
6d50d07
work on pr_afn_k8s
julsemaan Mar 23, 2024
aa52d07
work on pr_afn_k8s
julsemaan Mar 23, 2024
7ed6eb6
work on pr_afn_k8s
julsemaan Mar 23, 2024
7df74f6
work on pr_afn_k8s
julsemaan Mar 23, 2024
2e04149
work on pr_afn_k8s
julsemaan Mar 23, 2024
7ad58a1
work on pr_afn_k8s
julsemaan Mar 23, 2024
90bd4c7
work on pr_afn_k8s
julsemaan Mar 23, 2024
e5ffde3
work on pr_afn_k8s
julsemaan Mar 23, 2024
eb3ea2d
work on pr_afn_k8s
julsemaan Mar 23, 2024
ddfb964
work on pr_afn_k8s
julsemaan Mar 23, 2024
1f678cf
work on pr_afn_k8s
julsemaan Mar 23, 2024
a2c6503
work on pr_afn_k8s
julsemaan Mar 23, 2024
b2aa4c3
work on pr_afn_k8s
julsemaan Mar 23, 2024
b899292
work on pr_afn_k8s
julsemaan Mar 23, 2024
54aa655
work on pr_afn_k8s
julsemaan Mar 23, 2024
4354377
work on pr_afn_k8s
julsemaan Mar 23, 2024
03cdf32
work on pr_afn_k8s
julsemaan Mar 23, 2024
7f2da3a
work on pr_afn_k8s
julsemaan Mar 23, 2024
3a403bb
work on pr_afn_k8s
julsemaan Mar 23, 2024
8c17d5a
work on pr_afn_k8s
julsemaan Mar 23, 2024
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
48 changes: 47 additions & 1 deletion .github/workflows/docker-admin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ on:
jobs:
docker:
runs-on: ubuntu-latest
outputs:
img_tag: ${{ steps.preserve_img_tag.outputs.img_tag }}
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v4

- name: Setup VARS.js
run: 'printf "$ADMIN_VARS" > admin/js/VARS.js'
Expand All @@ -24,6 +26,11 @@ jobs:
run: |
echo "IMG_TAG=$(echo ${GITHUB_SHA} | sed -E 's/refs\/(heads|tags)\///g' | sed -e 's/\//-/g')" >> $GITHUB_ENV

- name: Preserve image tag
id: preserve_img_tag
run: |
echo "img_tag=${{ env.IMG_TAG }}" >> $GITHUB_OUTPUT

- name: Kaniko build
uses: julsemaan/action-kaniko@master
with:
Expand All @@ -35,4 +42,43 @@ jobs:
path: admin/
extra_args: >-
--push-retry 5

pr_afn_k8s:
concurrency:
group: prs-to-afn-k8s
cancel-in-progress: false
needs: docker
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: julsemaan/afn-k8s
token: ${{ secrets.GHA_REPO_TOKEN }}
fetch-depth: 0

- uses: frenck/action-setup-yq@v1

- name: PR tag change to afn-k8s
env:
IMG_TAG: ${{needs.docker.outputs.img_tag}}
GH_TOKEN: ${{ secrets.GHA_REPO_TOKEN }}
CHANGE_TYPE: admin
run: |
BRANCH_ID=`date "+%Y%m%d"`
BRANCH_NAME=tmp/$BRANCH_ID

# Checkout the remote ref if it already exist, otherwise, start from main
git checkout origin/$BRANCH_NAME || true
git checkout -b $BRANCH_NAME

yq -i '.lb.'$CHANGE_TYPE'.image.tag = "'$IMG_TAG'"' charts/afn/values.yaml

git config --global user.email "devnull@semaan.ca"
git config --global user.name "Semaan Bot"
git commit --allow-empty -a -m "bump $CHANGE_TYPE to $IMG_TAG"
git push origin HEAD

(gh pr list --state open --limit 1 --head $BRANCH_NAME | grep $BRANCH_NAME) || \
gh pr create -B main -H $BRANCH_NAME --title "Update images $BRANCH_ID" --body 'Created by Github action'

4 changes: 2 additions & 2 deletions .github/workflows/docker-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v4
- name: Kaniko build
uses: julsemaan/action-kaniko@master
with:
Expand All @@ -30,7 +30,7 @@ jobs:
if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/production'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v4

- name: Use staging target servers if necessary
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker-client-base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v4
- name: Kaniko build
uses: julsemaan/action-kaniko@master
with:
Expand Down
71 changes: 70 additions & 1 deletion .github/workflows/docker-client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ on:
jobs:
docker:
runs-on: ubuntu-latest
outputs:
img_tag: ${{ steps.preserve_img_tag.outputs.img_tag }}
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v4

- name: Setup VARS.js
run: 'printf "$AFN_VARS" > client/assets/js/VARS.js'
Expand All @@ -25,6 +27,11 @@ jobs:
run: |
echo "IMG_TAG=$(echo ${GITHUB_SHA} | sed -E 's/refs\/(heads|tags)\///g' | sed -e 's/\//-/g')" >> $GITHUB_ENV

- name: Preserve image tag
id: preserve_img_tag
run: |
echo "img_tag=${{ env.IMG_TAG }}" >> $GITHUB_OUTPUT

- name: Kaniko build full
uses: julsemaan/action-kaniko@master
with:
Expand Down Expand Up @@ -55,3 +62,65 @@ jobs:
--push-retry 5
--build-arg=SRC_IMAGE=ghcr.io/julsemaan/anyfile-notepad/client-full:${{ env.IMG_TAG }}

pr_afn_k8s:
needs: docker
concurrency:
group: prs-to-afn-k8s
cancel-in-progress: false
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: julsemaan/afn-k8s
token: ${{ secrets.GHA_REPO_TOKEN }}
fetch-depth: 0

- uses: frenck/action-setup-yq@v1

- name: PR tag change to afn-k8s
env:
IMG_TAG: ${{needs.docker.outputs.img_tag}}
GH_TOKEN: ${{ secrets.GHA_REPO_TOKEN }}
CHANGE_TYPE: appProdImage
run: |
BRANCH_ID=`date "+%Y%m%d"`
BRANCH_NAME=tmp/$BRANCH_ID

# Checkout the remote ref if it already exist, otherwise, start from main
git checkout origin/$BRANCH_NAME || true
git checkout -b $BRANCH_NAME

yq -i '.backend.'$CHANGE_TYPE'.tag = "'$IMG_TAG'"' charts/afn/values.yaml

git config --global user.email "devnull@semaan.ca"
git config --global user.name "Semaan Bot"
git commit --allow-empty -a -m "bump $CHANGE_TYPE to $IMG_TAG"
git push origin HEAD

(gh pr list --state open --limit 1 --head $BRANCH_NAME | grep $BRANCH_NAME) || \
gh pr create -B main -H $BRANCH_NAME --title "Update images $BRANCH_ID" --body 'Created by Github action'

#TODO: shouldn´t be pushing the same image for prod/dev client
- name: PR tag change to afn-k8s
env:
IMG_TAG: ${{needs.docker.outputs.img_tag}}
GH_TOKEN: ${{ secrets.GHA_REPO_TOKEN }}
CHANGE_TYPE: appDevImage
run: |
BRANCH_ID=`date "+%Y%m%d"`
BRANCH_NAME=tmp/$BRANCH_ID

# The branch already exists from the previous step
git checkout $BRANCH_NAME

yq -i '.backend.'$CHANGE_TYPE'.tag = "'$IMG_TAG'"' charts/afn/values.yaml

git config --global user.email "devnull@semaan.ca"
git config --global user.name "Semaan Bot"
git commit --allow-empty -a -m "bump $CHANGE_TYPE to $IMG_TAG"
git push origin HEAD

(gh pr list --state open --limit 1 --head $BRANCH_NAME | grep $BRANCH_NAME) || \
gh pr create -B main -H $BRANCH_NAME --title "Update images $BRANCH_ID" --body 'Created by Github action'

48 changes: 47 additions & 1 deletion .github/workflows/docker-pages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,20 @@ on:
jobs:
docker:
runs-on: ubuntu-latest
outputs:
img_tag: ${{ steps.preserve_img_tag.outputs.img_tag }}
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v4

- name: Compute image tag
run: |
echo "IMG_TAG=$(echo ${GITHUB_SHA} | sed -E 's/refs\/(heads|tags)\///g' | sed -e 's/\//-/g')" >> $GITHUB_ENV

- name: Preserve image tag
id: preserve_img_tag
run: |
echo "img_tag=${{ env.IMG_TAG }}" >> $GITHUB_OUTPUT

- name: Kaniko build full
uses: julsemaan/action-kaniko@master
with:
Expand All @@ -31,3 +38,42 @@ jobs:
extra_args: >-
--push-retry 5

pr_afn_k8s:
needs: docker
concurrency:
group: prs-to-afn-k8s
cancel-in-progress: false
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: julsemaan/afn-k8s
token: ${{ secrets.GHA_REPO_TOKEN }}
fetch-depth: 0

- uses: frenck/action-setup-yq@v1

- name: PR tag change to afn-k8s
env:
IMG_TAG: ${{needs.docker.outputs.img_tag}}
GH_TOKEN: ${{ secrets.GHA_REPO_TOKEN }}
CHANGE_TYPE: pages
run: |
BRANCH_ID=`date "+%Y%m%d"`
BRANCH_NAME=tmp/$BRANCH_ID

# Checkout the remote ref if it already exist, otherwise, start from main
git checkout origin/$BRANCH_NAME || true
git checkout -b $BRANCH_NAME

yq -i '.lb.'$CHANGE_TYPE'.image.tag = "'$IMG_TAG'"' charts/afn/values.yaml

git config --global user.email "devnull@semaan.ca"
git config --global user.name "Semaan Bot"
git commit --allow-empty -a -m "bump $CHANGE_TYPE to $IMG_TAG"
git push origin HEAD

(gh pr list --state open --limit 1 --head $BRANCH_NAME | grep $BRANCH_NAME) || \
gh pr create -B main -H $BRANCH_NAME --title "Update images $BRANCH_ID" --body 'Created by Github action'

47 changes: 46 additions & 1 deletion .github/workflows/docker-webserver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,20 @@ on:
jobs:
docker:
runs-on: ubuntu-latest
outputs:
img_tag: ${{ steps.preserve_img_tag.outputs.img_tag }}
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v4

- name: Compute image tag
run: |
echo "IMG_TAG=$(echo ${GITHUB_SHA} | sed -E 's/refs\/(heads|tags)\///g' | sed -e 's/\//-/g')" >> $GITHUB_ENV

- name: Preserve image tag
id: preserve_img_tag
run: |
echo "img_tag=${{ env.IMG_TAG }}" >> $GITHUB_OUTPUT

- name: Kaniko build
uses: julsemaan/action-kaniko@master
with:
Expand All @@ -31,3 +38,41 @@ jobs:
path: webserver/
extra_args: --push-retry 5

pr_afn_k8s:
needs: docker
concurrency:
group: prs-to-afn-k8s
cancel-in-progress: false
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: julsemaan/afn-k8s
token: ${{ secrets.GHA_REPO_TOKEN }}
fetch-depth: 0

- uses: frenck/action-setup-yq@v1

- name: PR tag change to afn-k8s
env:
IMG_TAG: ${{needs.docker.outputs.img_tag}}
GH_TOKEN: ${{ secrets.GHA_REPO_TOKEN }}
run: |
BRANCH_ID=`date "+%Y%m%d"`
BRANCH_NAME=tmp/$BRANCH_ID

# Checkout the remote ref if it already exist, otherwise, start from main
git checkout origin/$BRANCH_NAME || true
git checkout -b $BRANCH_NAME

yq -i '.backend.image.tag = "'$IMG_TAG'"' charts/afn/values.yaml

git config --global user.email "devnull@semaan.ca"
git config --global user.name "Semaan Bot"
git commit --allow-empty -a -m "bump $CHANGE_TYPE to $IMG_TAG"
git push origin HEAD

(gh pr list --state open --limit 1 --head $BRANCH_NAME | grep $BRANCH_NAME) || \
gh pr create -B main -H $BRANCH_NAME --title "Update images $BRANCH_ID" --body 'Created by Github action'