-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add looping capability + deploy configurationn (#4)
- Loading branch information
1 parent
d34bd9e
commit 04edc0c
Showing
6 changed files
with
144 additions
and
4 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
name: Build & Deploy | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
schedule: | ||
- cron: '10 17 * * 4' | ||
|
||
permissions: | ||
id-token: write | ||
contents: read | ||
packages: write | ||
|
||
jobs: | ||
package: | ||
uses: Chia-Network/actions/.github/workflows/docker-build.yaml@main | ||
|
||
deploy: | ||
name: Deploy ${{ matrix.mode.name }} | ||
needs: | ||
- package | ||
runs-on: [k8s-public] | ||
container: | ||
image: registry.gitlab.com/cmmarslender/kubectl-helm:v3 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
mode: | ||
- name: label-prs | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Vault Login | ||
uses: Chia-Network/actions/vault/login@main | ||
with: | ||
vault_url: ${{ secrets.VAULT_URL }} | ||
role_name: github-github-bot | ||
|
||
- name: Get secrets from vault | ||
uses: hashicorp/vault-action@v2 | ||
with: | ||
url: ${{ secrets.VAULT_URL }} | ||
token: ${{ env.VAULT_TOKEN }} | ||
secrets: | | ||
secret/data/fmt/k8s/fmt-k8s-internal api_server_url | K8S_API_SERVER_URL; | ||
secret/data/github_users/chiaautomation/github-bot token | BOT_GITHUB_TOKEN; | ||
secret/data/github/teams internal | INTERNAL_TEAM_NAME; | ||
- name: Login to k8s cluster | ||
uses: Chia-Network/actions/vault/k8s-login@main | ||
with: | ||
vault_url: ${{ secrets.VAULT_URL }} | ||
vault_token: ${{ env.VAULT_TOKEN }} | ||
backend_name: fmt-k8s-internal | ||
role_name: github-actions | ||
cluster_url: ${{ env.K8S_API_SERVER_URL }} | ||
|
||
- uses: Chia-Network/actions/helm/deploy@main | ||
env: | ||
DOCKER_TAG: "sha-${{ github.sha }}" | ||
with: | ||
namespace: "github-bot" | ||
app_name: "github-bot-${{ matrix.mode.name }}" | ||
helm_chart_repo: "https://chia-network.github.io/helm-charts" | ||
helm_chart: "generic" | ||
helm_values: "./k8s/${{ matrix.mode.name }}.yml" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
name: Build Docker Images | ||
|
||
on: | ||
pull_request: | ||
workflow_call: | ||
|
||
concurrency: | ||
# SHA is added to the end if on `main` to let all main workflows run | ||
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/heads/long_lived/')) && github.sha || '' }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
package: | ||
uses: Chia-Network/actions/.github/workflows/docker-build.yaml@main |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM golang:1 as builder | ||
|
||
COPY . /app | ||
WORKDIR /app | ||
RUN make build | ||
|
||
FROM gcr.io/distroless/static-debian12 | ||
|
||
COPY --from=builder /app/bin/github-bot /github-bot | ||
|
||
ENTRYPOINT ["/github-bot", "--config", "/config.yml"] |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
replicaCount: 1 | ||
image: | ||
repository: ghcr.io/chia-network/github-bot | ||
tag: {{ DOCKER_TAG }} | ||
|
||
deployment: | ||
args: | ||
- label-prs | ||
- --loop | ||
|
||
# Creates a secret with the following values, and mounts as a file into the main deployment container | ||
secretFile: | ||
mountPath: "/config.yml" | ||
stringValues: | ||
github_token: "{{ BOT_GITHUB_TOKEN }}" | ||
internal_team: "{{ INTERNAL_TEAM_NAME }}" | ||
label_internal: "" | ||
label_external: "community-pr" | ||
label_check_repos: | ||
- name: "Chia-Network/chia-blockchain" | ||
minimum_number: 17788 | ||
label_skip_users: | ||
- "dependabot[bot]" | ||
|