diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index 2534ad5..1a8dd89 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -9,63 +9,66 @@ on: jobs: build: - name: Build container + name: Build container and manifests runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 + - name: Login to registry + uses: docker/login-action@v3 + with: + registry: git.huizinga.dev + username: ${{ gitea.actor }} + password: ${{ secrets.REGISTRY_TOKEN }} + - name: Docker meta id: meta uses: docker/metadata-action@v5 with: images: git.huizinga.dev/dreaded_x/${{ gitea.event.repository.name}} tags: | + type=edge type=ref,event=branch - type=ref,event=pr - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} + type=semver,pattern=v{{version}} + type=semver,pattern=v{{major}}.{{minor}} + type=semver,pattern=v{{major}} type=sha - - name: Login to registry - uses: docker/login-action@v3 - with: - registry: git.huizinga.dev - username: ${{ gitea.actor }} - password: ${{ secrets.REGISTRY_TOKEN }} + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 - name: Build and push Docker image - uses: https://github.com/docker/build-push-action@v5 + id: build + uses: docker/build-push-action@v6 with: context: . push: true + load: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - manifests: - name: Publish manifests - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 + - name: Testing 1 + run: | + echo "imageid = ${{ steps.build.outputs.imageid }}" + echo "digest = ${{ steps.build.outputs.digest }}" + echo "metadata = ${{ steps.build.outputs.metadata }}" + echo "tags = ${{ steps.meta.outputs.tags }}" + echo "labels = ${{ steps.meta.outputs.labels }}" + + - name: Testing 2 + run: | + docker image inspect git.huizinga.dev/dreaded_x/${{ gitea.event.repository.name }}@${{ steps.build.outputs.digest }} + + - name: Generate CRDs + run: | + docker run --rm git.huizinga.dev/dreaded_x/${{ gitea.event.repository.name }}@${{ steps.build.outputs.digest }} crdgen > ./manifests/crds.yaml + cat ./crds.yaml - name: Install kustomize run: | curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash - - name: Setup Flux CLI - uses: https://github.com/fluxcd/flux2/action@main - with: - version: v2.5.0 - - - name: Login to registry - uses: docker/login-action@v3 - with: - registry: git.huizinga.dev - username: ${{ gitea.actor }} - password: ${{ secrets.REGISTRY_TOKEN }} - - # TODO: Generate and include crds - name: Generate manifets run: | ./kustomize build ./manifests | sed "s/\${SHA_SHORT}/$(git rev-parse --short HEAD)/" > ./app.yaml @@ -80,4 +83,4 @@ jobs: - name: Tag manifests run: | flux tag artifact oci://git.huizinga.dev/dreaded_x/${{ gitea.event.repository.name }}/manifests:sha-$(git rev-parse --short HEAD) \ - --tag latest + --tag edge diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d75dab1..0bd36bd 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,6 +4,7 @@ repos: hooks: - id: trailing-whitespace - id: end-of-file-fixer + - id: check-yaml - id: check-toml - id: check-added-large-files - id: check-merge-conflict diff --git a/manifests/kustomization.yaml b/manifests/kustomization.yaml index c40ff6d..a02d6c5 100644 --- a/manifests/kustomization.yaml +++ b/manifests/kustomization.yaml @@ -2,6 +2,7 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization namespace: lldap resources: + - ./crds.yaml - ./service-account.yaml - ./cluster-role.yaml - ./cluster-role-binding.yaml