Skip to content
This repository has been archived by the owner on Apr 20, 2024. It is now read-only.

Commit

Permalink
Add build and deploy config
Browse files Browse the repository at this point in the history
  • Loading branch information
george-angel committed Apr 15, 2024
1 parent 1314227 commit 7b34f1c
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 5 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: build

on:
push:
branches:
- "master"
tags:
- "v*"
pull_request:
branches:
- "master"

permissions:
contents: write

env:
REGISTRY: quay.io
IMAGE_NAME: ${{ github.repository }}

jobs:
docker:
runs-on: ubuntu-latest
if: github.actor != 'dependabot[bot]'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Login to Quay.io Container Registry
uses: docker/login-action@v3
with:
registry: quay.io
username: utilitywarehouse+drone_ci
password: ${{ secrets.SYSTEM_QUAY_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
22 changes: 22 additions & 0 deletions .github/workflows/dependabot-auto-approve.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions#approve-a-pull-request
name: Dependabot auto-approve
on: pull_request

permissions:
pull-requests: write

jobs:
dependabot:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/[email protected]
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Approve a PR
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
23 changes: 23 additions & 0 deletions .github/workflows/dependabot-auto-merge.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions#enable-auto-merge-on-a-pull-request
name: Dependabot auto-merge
on: pull_request

permissions:
pull-requests: write
contents: write

jobs:
dependabot:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/[email protected]
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Enable auto-merge for Dependabot PRs
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
10 changes: 5 additions & 5 deletions kube-control-plane-labeller
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/sh

set -e;
set -euo pipefail

KUBE_TOKEN=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token);
KUBE_TOKEN=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token)

labelsPresent="false"
while [[ "${labelsPresent}" == "false" ]]; do
Expand All @@ -13,10 +13,10 @@ while [[ "${labelsPresent}" == "false" ]]; do
-H "Content-Type: application/strategic-merge-patch+json" \
-X PATCH \
-d '{"metadata": {"labels":{"node-role.kubernetes.io/master": "", "node-role.kubernetes.io/control-plane": ""}}}' \
https://${KUBERNETES_SERVICE_HOST}:${KUBERNETES_SERVICE_PORT}/api/v1/nodes/${NODE_NAME}/status;)
https://${KUBERNETES_SERVICE_HOST}:${KUBERNETES_SERVICE_PORT}/api/v1/nodes/${NODE_NAME}/status)
echo ${body}
labelsPresent=$(echo ${body} | jq -r '.metadata.labels | has("node-role.kubernetes.io/master") and has("node-role.kubernetes.io/control-plane")')
sleep 5;
done;
sleep 5
done
echo "Node labelled, sleeping..."
sleep infinity

0 comments on commit 7b34f1c

Please sign in to comment.