Improve workflow and generate CRDs
Some checks failed
Build and deploy / Build container and manifests (push) Failing after 5m0s
Some checks failed
Build and deploy / Build container and manifests (push) Failing after 5m0s
This commit is contained in:
parent
69588d2748
commit
2633971286
|
@ -9,75 +9,75 @@ on:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build container
|
name: Build container and manifests
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
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
|
- name: Docker meta
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v5
|
||||||
with:
|
with:
|
||||||
images: git.huizinga.dev/dreaded_x/${{ gitea.event.repository.name}}
|
images: git.huizinga.dev/dreaded_x/${{ gitea.event.repository.name}}
|
||||||
tags: |
|
tags: |
|
||||||
|
type=edge
|
||||||
type=ref,event=branch
|
type=ref,event=branch
|
||||||
type=ref,event=pr
|
type=semver,pattern=v{{version}}
|
||||||
type=semver,pattern={{version}}
|
type=semver,pattern=v{{major}}.{{minor}}
|
||||||
type=semver,pattern={{major}}.{{minor}}
|
type=semver,pattern=v{{major}}
|
||||||
type=sha
|
|
||||||
|
|
||||||
- name: Login to registry
|
- name: Set up Docker Buildx
|
||||||
uses: docker/login-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Build and export to docker
|
||||||
|
id: build
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
registry: git.huizinga.dev
|
context: .
|
||||||
username: ${{ gitea.actor }}
|
load: true
|
||||||
password: ${{ secrets.REGISTRY_TOKEN }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
|
||||||
- name: Build and push Docker image
|
- name: Generate CRDs
|
||||||
uses: https://github.com/docker/build-push-action@v5
|
run: |
|
||||||
|
echo ${{ steps.build.outputs.digest }}
|
||||||
|
|
||||||
|
- name: Generate CRDs
|
||||||
|
run: |
|
||||||
|
docker run --rm ${{ steps.build.outputs.imageid }} crdgen > ./manifests/crds.yaml
|
||||||
|
cat ./crds.yaml
|
||||||
|
|
||||||
|
- name: Push container
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
id: push
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
push: true
|
push: true
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
|
||||||
manifests:
|
|
||||||
name: Publish manifests
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Install kustomize
|
- name: Install kustomize
|
||||||
run: |
|
run: |
|
||||||
curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash
|
curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash
|
||||||
|
|
||||||
- name: Setup Flux CLI
|
- name: Kustomize manifests
|
||||||
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: |
|
run: |
|
||||||
./kustomize build ./manifests | sed "s/\${SHA_SHORT}/$(git rev-parse --short HEAD)/" > ./app.yaml
|
./kustomize build ./manifests | sed "s/\${DIGEST}/${{ steps.push.outputs.digest }}/" > ./manifests.yaml
|
||||||
|
|
||||||
- name: Push manifests
|
- name: Push manifests
|
||||||
run: |
|
run: |
|
||||||
flux push artifact oci://git.huizinga.dev/dreaded_x/${{ gitea.event.repository.name }}/manifests:sha-$(git rev-parse --short HEAD) \
|
flux push artifact oci://git.huizinga.dev/dreaded_x/${{ gitea.event.repository.name }}/manifests:latest \
|
||||||
--path="./app.yaml" \
|
--path="./manifests.yaml" \
|
||||||
--source="$(git config --get remote.origin.url)" \
|
--source="$(git config --get remote.origin.url)" \
|
||||||
--revision="$(git branch --show-current)@sha1:$(git rev-parse HEAD)"
|
--revision="$(git branch --show-current)@sha1:$(git rev-parse HEAD)" \
|
||||||
|
$(echo ${{ steps.meta.outputs.labels }} | sed -e 's/^/-a /')
|
||||||
|
|
||||||
- name: Tag manifests
|
|
||||||
run: |
|
|
||||||
flux tag artifact oci://git.huizinga.dev/dreaded_x/${{ gitea.event.repository.name }}/manifests:sha-$(git rev-parse --short HEAD) \
|
flux tag artifact oci://git.huizinga.dev/dreaded_x/${{ gitea.event.repository.name }}/manifests:sha-$(git rev-parse --short HEAD) \
|
||||||
--tag latest
|
$(echo ${{ steps.meta.outputs.tags }} | sed -e 's/^.*:/--tag /')
|
||||||
|
|
|
@ -4,6 +4,7 @@ repos:
|
||||||
hooks:
|
hooks:
|
||||||
- id: trailing-whitespace
|
- id: trailing-whitespace
|
||||||
- id: end-of-file-fixer
|
- id: end-of-file-fixer
|
||||||
|
- id: check-yaml
|
||||||
- id: check-toml
|
- id: check-toml
|
||||||
- id: check-added-large-files
|
- id: check-added-large-files
|
||||||
- id: check-merge-conflict
|
- id: check-merge-conflict
|
||||||
|
|
|
@ -21,7 +21,7 @@ spec:
|
||||||
securityContext: {}
|
securityContext: {}
|
||||||
containers:
|
containers:
|
||||||
- name: lldap-controller
|
- name: lldap-controller
|
||||||
image: git.huizinga.dev/dreaded_x/lldap-controller:sha-${SHA_SHORT}
|
image: git.huizinga.dev/dreaded_x/lldap-controller@${DIGEST}
|
||||||
imagePullPolicy: IfNotPresent
|
imagePullPolicy: IfNotPresent
|
||||||
securityContext: {}
|
securityContext: {}
|
||||||
resources:
|
resources:
|
||||||
|
|
|
@ -2,6 +2,7 @@ apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
kind: Kustomization
|
kind: Kustomization
|
||||||
namespace: lldap
|
namespace: lldap
|
||||||
resources:
|
resources:
|
||||||
|
- ./crds.yaml
|
||||||
- ./service-account.yaml
|
- ./service-account.yaml
|
||||||
- ./cluster-role.yaml
|
- ./cluster-role.yaml
|
||||||
- ./cluster-role-binding.yaml
|
- ./cluster-role-binding.yaml
|
||||||
|
|
Loading…
Reference in New Issue
Block a user