Skip to content

Commit

Permalink
Migrate bot
Browse files Browse the repository at this point in the history
  • Loading branch information
bbedward committed Jun 25, 2024
1 parent 0bb4435 commit f900032
Show file tree
Hide file tree
Showing 3 changed files with 116 additions and 128 deletions.
220 changes: 110 additions & 110 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: CI

on:
push:
branches: [ master ]
branches: [master]

jobs:
test:
Expand Down Expand Up @@ -30,9 +30,9 @@ jobs:
needs: test
runs-on: ubuntu-latest
env:
GITHUB_RUN_ID: ${{ github.run_id }}
GITHUB_RUN_ID: ${{ github.run_id }}
steps:
- uses: actions/checkout@master
- uses: actions/checkout@master

- name: Get branch name (merge)
if: github.event_name != 'pull_request'
Expand All @@ -54,7 +54,7 @@ jobs:
if: success()
run: docker build -t bananocoin/graham:${{ env.BRANCH_NAME }}-${{ env.GITHUB_RUN_ID }} .

- name: Push image
- name: Push image
if: success()
uses: actions-hub/docker@master
with:
Expand All @@ -67,10 +67,10 @@ jobs:
env:
GITHUB_RUN_ID: ${{ github.run_id }}
steps:
- uses: actions/checkout@master
- uses: actions/checkout@master
- uses: imranismail/setup-kustomize@v1
with:
kustomize-version: "3.x"
kustomize-version: '3.x'

- name: Get branch name (merge)
if: github.event_name != 'pull_request'
Expand All @@ -95,107 +95,107 @@ jobs:
with:
args: apply -f ./kubernetes/bbet/deployment-k.yaml

deploy_nano:
name: Deploy nano discord bot
needs: build_and_publish
runs-on: ubuntu-latest
env:
GITHUB_RUN_ID: ${{ github.run_id }}
steps:
- uses: actions/checkout@master
- uses: imranismail/setup-kustomize@v1
with:
kustomize-version: "3.x"

- name: Get branch name (merge)
if: github.event_name != 'pull_request'
shell: bash
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV

- name: Get branch name (pull request)
if: github.event_name == 'pull_request'
shell: bash
run: echo "BRANCH_NAME=$(echo ${GITHUB_HEAD_REF} | tr / -)" >> $GITHUB_ENV

- name: Set image
working-directory: ./kubernetes/nano
run: |
kustomize edit set image replaceme=bananocoin/graham:${{ env.BRANCH_NAME }}-${{ env.GITHUB_RUN_ID }}
kustomize build . > deployment-k.yaml
- name: Deploy image to k8s cluster
uses: bbedward/kubectl@master
env:
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
with:
args: apply -f ./kubernetes/nano/deployment-k.yaml

deploy_graham_banano:
name: Deploy graham bot (banano)
needs: build_and_publish
runs-on: ubuntu-latest
env:
GITHUB_RUN_ID: ${{ github.run_id }}
steps:
- uses: actions/checkout@master
- uses: imranismail/setup-kustomize@v1
with:
kustomize-version: "3.x"

- name: Get branch name (merge)
if: github.event_name != 'pull_request'
shell: bash
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV

- name: Get branch name (pull request)
if: github.event_name == 'pull_request'
shell: bash
run: echo "BRANCH_NAME=$(echo ${GITHUB_HEAD_REF} | tr / -)" >> $GITHUB_ENV

- name: Set image
working-directory: ./kubernetes/graham_banano
run: |
kustomize edit set image replaceme=bananocoin/graham:${{ env.BRANCH_NAME }}-${{ env.GITHUB_RUN_ID }}
kustomize build . > deployment-k.yaml
- name: Deploy image to k8s cluster
uses: bbedward/kubectl@master
env:
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
with:
args: apply -f ./kubernetes/graham_banano/deployment-k.yaml

deploy_bananobot:
name: Deploy BananoBot++
needs: build_and_publish
runs-on: ubuntu-latest
env:
GITHUB_RUN_ID: ${{ github.run_id }}
steps:
- uses: actions/checkout@master
- uses: imranismail/setup-kustomize@v1
with:
kustomize-version: "3.x"

- name: Get branch name (merge)
if: github.event_name != 'pull_request'
shell: bash
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV

- name: Get branch name (pull request)
if: github.event_name == 'pull_request'
shell: bash
run: echo "BRANCH_NAME=$(echo ${GITHUB_HEAD_REF} | tr / -)" >> $GITHUB_ENV

- name: Set image
working-directory: ./kubernetes/bananobot
run: |
kustomize edit set image replaceme=bananocoin/graham:${{ env.BRANCH_NAME }}-${{ env.GITHUB_RUN_ID }}
kustomize build . > deployment-k.yaml
- name: Deploy image to k8s cluster
uses: bbedward/kubectl@master
env:
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
with:
args: apply -f ./kubernetes/bananobot/deployment-k.yaml
# deploy_nano:
# name: Deploy nano discord bot
# needs: build_and_publish
# runs-on: ubuntu-latest
# env:
# GITHUB_RUN_ID: ${{ github.run_id }}
# steps:
# - uses: actions/checkout@master
# - uses: imranismail/setup-kustomize@v1
# with:
# kustomize-version: "3.x"

# - name: Get branch name (merge)
# if: github.event_name != 'pull_request'
# shell: bash
# run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV

# - name: Get branch name (pull request)
# if: github.event_name == 'pull_request'
# shell: bash
# run: echo "BRANCH_NAME=$(echo ${GITHUB_HEAD_REF} | tr / -)" >> $GITHUB_ENV

# - name: Set image
# working-directory: ./kubernetes/nano
# run: |
# kustomize edit set image replaceme=bananocoin/graham:${{ env.BRANCH_NAME }}-${{ env.GITHUB_RUN_ID }}
# kustomize build . > deployment-k.yaml

# - name: Deploy image to k8s cluster
# uses: bbedward/kubectl@master
# env:
# KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
# with:
# args: apply -f ./kubernetes/nano/deployment-k.yaml

# deploy_graham_banano:
# name: Deploy graham bot (banano)
# needs: build_and_publish
# runs-on: ubuntu-latest
# env:
# GITHUB_RUN_ID: ${{ github.run_id }}
# steps:
# - uses: actions/checkout@master
# - uses: imranismail/setup-kustomize@v1
# with:
# kustomize-version: "3.x"

# - name: Get branch name (merge)
# if: github.event_name != 'pull_request'
# shell: bash
# run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV

# - name: Get branch name (pull request)
# if: github.event_name == 'pull_request'
# shell: bash
# run: echo "BRANCH_NAME=$(echo ${GITHUB_HEAD_REF} | tr / -)" >> $GITHUB_ENV

# - name: Set image
# working-directory: ./kubernetes/graham_banano
# run: |
# kustomize edit set image replaceme=bananocoin/graham:${{ env.BRANCH_NAME }}-${{ env.GITHUB_RUN_ID }}
# kustomize build . > deployment-k.yaml

# - name: Deploy image to k8s cluster
# uses: bbedward/kubectl@master
# env:
# KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
# with:
# args: apply -f ./kubernetes/graham_banano/deployment-k.yaml

# deploy_bananobot:
# name: Deploy BananoBot++
# needs: build_and_publish
# runs-on: ubuntu-latest
# env:
# GITHUB_RUN_ID: ${{ github.run_id }}
# steps:
# - uses: actions/checkout@master
# - uses: imranismail/setup-kustomize@v1
# with:
# kustomize-version: "3.x"

# - name: Get branch name (merge)
# if: github.event_name != 'pull_request'
# shell: bash
# run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV

# - name: Get branch name (pull request)
# if: github.event_name == 'pull_request'
# shell: bash
# run: echo "BRANCH_NAME=$(echo ${GITHUB_HEAD_REF} | tr / -)" >> $GITHUB_ENV

# - name: Set image
# working-directory: ./kubernetes/bananobot
# run: |
# kustomize edit set image replaceme=bananocoin/graham:${{ env.BRANCH_NAME }}-${{ env.GITHUB_RUN_ID }}
# kustomize build . > deployment-k.yaml

# - name: Deploy image to k8s cluster
# uses: bbedward/kubectl@master
# env:
# KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
# with:
# args: apply -f ./kubernetes/bananobot/deployment-k.yaml
12 changes: 3 additions & 9 deletions kubernetes/bbet/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,11 @@ spec:
- name: REDIS_DB
value: "5"
- name: POSTGRES_HOST
value: postgres.kubegres
value: pg-bbet.graham-banano
- name: POSTGRES_DB
valueFrom:
secretKeyRef:
name: graham-bbet
key: postgres_db
value: postgres
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: graham-bbet
key: postgres_user
value: postgres
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
Expand Down
12 changes: 3 additions & 9 deletions kubernetes/bbet/deployment_server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,11 @@ spec:
- name: REDIS_DB
value: "5"
- name: POSTGRES_HOST
value: postgres.kubegres
value: pg-bbet.graham-banano
- name: POSTGRES_DB
valueFrom:
secretKeyRef:
name: graham-bbet
key: postgres_db
value: postgres
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: graham-bbet
key: postgres_user
value: postgres
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
Expand Down

0 comments on commit f900032

Please sign in to comment.