update to new interfaces

This commit is contained in:
Robert Schäfer 2024-10-27 15:26:53 +01:00
parent 5b0e1ab07d
commit 841bc4d66a
8 changed files with 30 additions and 35 deletions

View File

@ -1,6 +1,16 @@
name: publish name: publish
on: push on:
workflow_dispatch:
inputs:
ocelot_version:
description: Ocelot build image version
required: true
type: string
deploy:
description: Deploy to cluster
required: true
type: boolean
jobs: jobs:
build-and-push-images: build-and-push-images:
@ -38,13 +48,13 @@ jobs:
with: with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: | tags: |
type=schedule type=schedule,prefix=ocelot-${{ inputs.ocelot_version }}--branded-
type=semver,pattern={{version}} type=semver,pattern={{version}},prefix=ocelot-${{ inputs.ocelot_version }}--branded-
type=semver,pattern={{major}}.{{minor}} type=semver,pattern={{major}}.{{minor}},prefix=ocelot-${{ inputs.ocelot_version }}--branded-
type=semver,pattern={{major}} type=semver,pattern={{major}},prefix=ocelot-${{ inputs.ocelot_version }}--branded-
type=ref,event=branch type=ref,event=branch,prefix=ocelot-${{ inputs.ocelot_version }}--branded-
type=ref,event=pr type=ref,event=pr,prefix=ocelot-${{ inputs.ocelot_version }}--branded-
type=sha type=sha,prefix=ocelot-${{ inputs.ocelot_version }}--branded-sha-
- name: Build and push Docker images - name: Build and push Docker images
id: push id: push
uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75
@ -53,13 +63,13 @@ jobs:
context: . context: .
push: true push: true
build-args: | build-args: |
OCELOT_VERSION=hetzner OCELOT_VERSION=${{ inputs.ocelot_version }}
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}
deploy-to-kubernetes: deploy-to-kubernetes:
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: github.ref == 'refs/heads/staging' if: ${{ inputs.deploy }}
needs: build-and-push-images needs: build-and-push-images
steps: steps:
- uses: mdgreenwald/mozilla-sops-action@d9714e521cbaecdae64a89d2fdd576dd2aa97056 # v1.6.0 - uses: mdgreenwald/mozilla-sops-action@d9714e521cbaecdae64a89d2fdd576dd2aa97056 # v1.6.0
@ -73,7 +83,7 @@ jobs:
mkdir -p ~/.kube mkdir -p ~/.kube
sops decrypt ./helmfile/secrets/kubeconfig > ~/.kube/config sops decrypt ./helmfile/secrets/kubeconfig > ~/.kube/config
chmod 600 ~/.kube/config chmod 600 ~/.kube/config
# - run: echo "IMAGE_TAG=sha-$(echo $GITHUB_SHA | cut -c 1-7)" >> $GITHUB_ENV - run: echo "IMAGE_TAG=ocelot-${{ inputs.ocelot_version }}--branded-sha-$(echo $GITHUB_SHA | cut -c 1-7)" >> $GITHUB_ENV
- uses: helmfile/helmfile-action@80fbb6408b98822310f94d8d1321a2cacf87f78f #v1.9.2 - uses: helmfile/helmfile-action@80fbb6408b98822310f94d8d1321a2cacf87f78f #v1.9.2
with: with:
helmfile-args: apply --environment staging helmfile-args: apply --environment staging

View File

@ -1,6 +1,6 @@
ARG OCELOT_VERSION=master ARG OCELOT_VERSION=master
FROM ghcr.io/ocelot-social-community/ocelot-social/backend:${OCELOT_VERSION}-code AS build FROM ghcr.io/ocelot-social-community/ocelot-social/backend-build:${OCELOT_VERSION} AS build
FROM ghcr.io/ocelot-social-community/ocelot-social/backend:${OCELOT_VERSION}-base AS branded FROM ghcr.io/ocelot-social-community/ocelot-social/backend-base:${OCELOT_VERSION} AS branded
COPY --from=build /build . COPY --from=build /build .

View File

@ -1,7 +1,7 @@
ARG OCELOT_VERSION=master ARG OCELOT_VERSION=master
FROM ghcr.io/ocelot-social-community/ocelot-social/maintenance:${OCELOT_VERSION}-code AS build FROM ghcr.io/ocelot-social-community/ocelot-social/maintenance-build:${OCELOT_VERSION} AS build
FROM nginx:alpine AS branded FROM ghcr.io/ocelot-social-community/ocelot-social/maintenance-base:${OCELOT_VERSION} AS branded
COPY --from=build ./app/dist/ /usr/share/nginx/html/ COPY --from=build ./app/dist/ /usr/share/nginx/html/
COPY --from=build ./app/maintenance/nginx/custom.conf /etc/nginx/conf.d/default.conf COPY --from=build ./app/maintenance/nginx/custom.conf /etc/nginx/conf.d/default.conf

View File

@ -1,6 +1,6 @@
ARG OCELOT_VERSION=master ARG OCELOT_VERSION=master
FROM ghcr.io/ocelot-social-community/ocelot-social/webapp:${OCELOT_VERSION}-code AS build FROM ghcr.io/ocelot-social-community/ocelot-social/webapp-build:${OCELOT_VERSION} AS build
FROM ghcr.io/ocelot-social-community/ocelot-social/webapp:${OCELOT_VERSION}-base AS branded FROM ghcr.io/ocelot-social-community/ocelot-social/webapp-base:${OCELOT_VERSION} AS branded
COPY --from=build /build . COPY --from=build /build .

View File

@ -1,5 +0,0 @@
{{ $image_tag:= env "IMAGE_TAG" | default (exec "../scripts/image_tag.sh" (list) | trim) }}
domain: ocelot-social.roschaefer.de
namespace: ocelot-staging
image_tag: {{ $image_tag }}

View File

@ -1,5 +1,3 @@
{{ $image_tag:= env "IMAGE_TAG" | default (exec "../scripts/image_tag.sh" (list) | trim) }} domain: staging.ocelot-social.roschaefer.de
domain: ocelot-social.roschaefer.de
namespace: ocelot-staging namespace: ocelot-staging
image_tag: {{ $image_tag }} image_tag: {{ requiredEnv "IMAGE_TAG" }}

View File

@ -1,18 +1,12 @@
--- ---
environments: environments:
default:
values:
- ./environments/default.yaml.gotmpl
staging: staging:
values: values:
- ./environments/staging.yaml.gotmpl - ./environments/staging.yaml.gotmpl
production:
values:
- ./environments/production.yaml.gotmpl
--- ---
repositories: repositories:
- name: ocelot-social - name: ocelot-social
url: git+https://github.com/Ocelot-Social-Community/Ocelot-Social@deployment/hetzner/helmfile/ocelot-social?ref=hetzner url: git+https://github.com/Ocelot-Social-Community/Ocelot-Social@deployment/helm/chart?ref=hetzner
apiVersions: apiVersions:
- monitoring.coreos.com/v1 - monitoring.coreos.com/v1

View File

@ -1,2 +0,0 @@
#!/usr/bin/env bash
echo "sha-$(git rev-parse HEAD | cut -c 1-7)"