Getting CI/CD working

Restore the gates on images running

fix docker hub path for image

Drop down one version on teh build plugin

Drop down one version on teh build plugin

Drop down one version on teh build plugin

force test the build and push workflow

fix image tag in ci/cd

Set push to true on workflow

fix argo command

making a small change to get the pipeline to run

tsting argocd action

Test the filters workflow

Test the filters workflow

test

check if python was changed

check if python was changed

Indent build block

Trying more ci/cd shit

Trying more ci/cd shit

Trying more ci/cd shit

Trying more ci/cd shit

Trying more ci/cd shit

Trying more ci/cd shit

Trying more ci/cd shit

tryin more shit

more ci/cd testing

more ci/cd testing

commiting an obvious bad python change to see if CI/CD bails

testing

testing

testing

testing

testing

testing

Testing workflow
This commit is contained in:
Luke Robles 2024-05-02 11:42:04 -07:00
parent 46df8f4e0d
commit 2186452225
5 changed files with 75 additions and 72 deletions

View File

@ -0,0 +1,73 @@
name: Build and push
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
on: [push]
jobs:
changes:
runs-on: ubuntu-latest
outputs:
python_files: ${{ steps.filter.outputs.python_files }}
helm_files: ${{ steps.filter.outputs.helm }}
steps:
- name: Check out repository code
uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
python_files:
- 'app/**'
helm:
- 'helm/**'
Lint-Python:
runs-on: ubuntu-latest
needs: changes
if: ${{ needs.changes.outputs.python_files == 'true' }}
steps:
- name: Check out repository code
uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
python_files:
- 'app/**/*.py'
- name: install UV
run: |
pip install uv --quiet
if: steps.filter.outputs.python_files == 'true'
- name: install black and lint code
run: |
uv pip install black --system --quiet
black app --check --fast
if: steps.filter.outputs.python_files == 'true'
Build-and-Push-Docker:
needs: changes
if: ${{ needs.changes.outputs.python_files == 'true' }}
steps:
- name: Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Check out repository code
uses: actions/checkout@v4
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: |
ldooks/dragon-bot:latest
ldooks/dragon-bot:${{ gitea.run_id }}
sync-argocd-app:
needs: [changes, Build-and-Push-Docker]
if: ${{ needs.changes.outputs.python_files == 'true' }}
steps:
- name: Sync app in ArgoCD
uses: clowdhaus/argo-cd-action/@main
with:
version: 2.6.7
command: app
options: --insecure --server 192.168.1.205 --auth-token ${{ secrets.ARGOCD_TOKEN }} set dragon-bot --helm-set image.tag=${{ gitea.run_id }}

View File

@ -1,58 +0,0 @@
image: docker:dind
services:
- name: docker:dind
entrypoint: ["env", "-u", "DOCKER_HOST"]
command: ["dockerd-entrypoint.sh"]
variables:
DOCKER_TLS_CERTDIR: ""
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
stages:
- lint_python
- lint_helm
- deploy
lint_helm:
image: alpine/helm
stage: lint_helm
script:
- helm lint ./helm
rules:
- changes:
- helm/*
lint_python:
image: python:alpine
stage: lint_python
script:
- pip install -q black && black --fast --check .
rules:
- changes:
- app/**/*
build_and_push_container:
stage: deploy
script:
- echo "Wait for Docker daemon at tcp://localhost:2375"
- while ! nc -z localhost 2375; do sleep 0.1; done # Wait until docker socket is available
- docker login -u ldooks -p $DOCKER_ACCESS_TOKEN
- docker build --platform linux/amd64 -t ldooks/dragon-bot:$CI_PIPELINE_IID -t ldooks/dragon-bot:latest .
- docker push ldooks/dragon-bot -a
rules:
- changes:
- app/**/*
- Dockerfile
sync_argo:
stage: .post
image: python:alpine
script:
- apk add --no-cache jq curl
- latest=$(curl -sL https://api.github.com/repos/argoproj/argo-cd/releases/latest | jq -r '.assets[] | select( .name | contains("argocd-linux-amd64")).browser_download_url')
- curl -Ls $latest -o /tmp/argocd && chmod +x /tmp/argocd
- /tmp/argocd --insecure --server argocd-server.argocd.svc.cluster.local --auth-token $ARGOCD_TOKEN app set dragon-bot --helm-set image.tag=$CI_PIPELINE_IID
rules:
- changes:
- helm/*
- app/**/*

View File

@ -1,11 +0,0 @@
### New Merge Request
- What?
* `briefly describe the issue this is fixing`
- How?
* `briefly describe what this PR is doing to remedy the issue`
- Why?
* `is there an open issue associated with this PR? if so, reference it with #56 (or whatever the issue number is)`
- Is it...?
* [ ] Based?
* [ ] Dale-pilled?

View File

@ -2,7 +2,6 @@ FROM python:3.10-rc as build
ADD app/requirements.txt /requirements.txt ADD app/requirements.txt /requirements.txt
ADD --chmod=755 https://astral.sh/uv/install.sh /install.sh ADD --chmod=755 https://astral.sh/uv/install.sh /install.sh
RUN /install.sh && rm /install.sh RUN /install.sh && rm /install.sh
# RUN pip install --disable-pip-version-check --verbose -r requirements.txt
RUN /root/.cargo/bin/uv pip install --system --verbose -r requirements.txt RUN /root/.cargo/bin/uv pip install --system --verbose -r requirements.txt
FROM python:3.10-rc-slim FROM python:3.10-rc-slim

View File

@ -14,13 +14,13 @@ class AnimalFunctions(commands.Cog):
await ctx.respond(animals.get_red_panda()) await ctx.respond(animals.get_red_panda())
@commands.slash_command( @commands.slash_command(
guild_ids=None, name="dog", description="Posts a photo of a dog" guild_ids=None, name="dog", description="Posts a photo of a Dog"
) )
async def dog(self, ctx: commands.Context): async def dog(self, ctx: commands.Context):
await ctx.respond(animals.get_dog()) await ctx.respond(animals.get_dog())
@commands.slash_command( @commands.slash_command(
guild_ids=None, name="sheeb", description="Posts a photo of a sheeb" guild_ids=None, name="sheeb", description="Posts a photo of a Sheeb"
) )
async def sheeb(self, ctx: commands.Context): async def sheeb(self, ctx: commands.Context):
await ctx.respond(animals.random_sheeb()) await ctx.respond(animals.random_sheeb())