Skip to content

Commit

Permalink
adapt to new api at ocelot-social
Browse files Browse the repository at this point in the history
  • Loading branch information
roschaefer committed Oct 27, 2024
1 parent 0ad9c8d commit 0062a88
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 37 deletions.
16 changes: 0 additions & 16 deletions .github/pull.yml

This file was deleted.

30 changes: 20 additions & 10 deletions .github/workflows/push.yml → .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
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:
build-and-push-images:
Expand Down Expand Up @@ -38,13 +48,13 @@ jobs:
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=schedule
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=ref,event=branch
type=ref,event=pr
type=sha
type=schedule,prefix=${{ inputs.ocelot_version }}_
type=semver,pattern={{version}},prefix=${{ inputs.ocelot_version }}_
type=semver,pattern={{major}}.{{minor}},prefix=${{ inputs.ocelot_version }}_
type=semver,pattern={{major}},prefix=${{ inputs.ocelot_version }}_
type=ref,event=branch,prefix=${{ inputs.ocelot_version }}_
type=ref,event=pr,prefix=${{ inputs.ocelot_version }}_
type=sha,prefix=${{ inputs.ocelot_version }}_
- name: Build and push Docker images
id: push
uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75
Expand All @@ -53,13 +63,13 @@ jobs:
context: .
push: true
build-args: |
OCELOT_VERSION=hetzner
OCELOT_VERSION=${{ inputs.ocelot_version }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

deploy-to-kubernetes:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/staging'
if: ${{ inputs.deploy }}
needs: build-and-push-images
steps:
- uses: mdgreenwald/mozilla-sops-action@d9714e521cbaecdae64a89d2fdd576dd2aa97056 # v1.6.0
Expand Down
4 changes: 2 additions & 2 deletions docker/backend.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
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 .
4 changes: 2 additions & 2 deletions docker/maintenance.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
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/maintenance/nginx/custom.conf /etc/nginx/conf.d/default.conf
4 changes: 2 additions & 2 deletions docker/webapp.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
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 .
5 changes: 3 additions & 2 deletions helmfile/environments/default.yaml.gotmpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{{ $branch := env "BRANCH" | default (exec "../scripts/branch.sh" (list) | trim) }}
{{ $image_tag:= env "IMAGE_TAG" | default (exec "../scripts/image_tag.sh" (list) | trim) }}

domain: reformer-network-staging.roschaefer.de
namespace: reformer-network-staging
domain: {{ env "DOMAIN" | default (printf "%s.git.reformer-network.roschaefer.de" $branch ) }}
namespace: {{ env "NAMESPACE" | default (printf "reformer-network-git-%s" $branch ) }}
image_tag: {{ $image_tag }}
2 changes: 1 addition & 1 deletion helmfile/environments/production.yaml.gotmpl
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
domain: reformer-network.roschaefer.de
domain: staging.reformer-network.roschaefer.de
namespace: reformer-network-production
image_tag: production
2 changes: 1 addition & 1 deletion helmfile/environments/staging.yaml.gotmpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{ $image_tag:= env "IMAGE_TAG" | default (exec "../scripts/image_tag.sh" (list) | trim) }}

domain: reformer-network-staging.roschaefer.de
domain: staging.reformer-network.roschaefer.de
namespace: reformer-network-staging
image_tag: {{ $image_tag }}
3 changes: 3 additions & 0 deletions helmfile/scripts/branch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash
# source https://stackoverflow.com/a/63286099
git rev-parse --abbrev-ref HEAD | iconv -c -t ascii//TRANSLIT | sed -E 's/[~^]+//g' | sed -E 's/[^a-zA-Z0-9]+/-/g' | sed -E 's/^-+|-+$//g' | tr A-Z a-z
2 changes: 1 addition & 1 deletion helmfile/scripts/image_tag.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/usr/bin/env bash
echo "sha-$(git rev-parse HEAD | cut -c 1-7)"
echo "master_sha-$(git rev-parse HEAD | cut -c 1-7)"

0 comments on commit 0062a88

Please sign in to comment.