Skip to content

Commit

Permalink
Merge pull request #5 from sonroyaalmerol/helm
Browse files Browse the repository at this point in the history
Initial draft of helm chart
  • Loading branch information
sonroyaalmerol authored May 16, 2024
2 parents a24f9a5 + cd0268c commit 4b09f11
Show file tree
Hide file tree
Showing 21 changed files with 1,433 additions and 428 deletions.
22 changes: 11 additions & 11 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "docker" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "docker" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
124 changes: 64 additions & 60 deletions .github/workflows/develop.yml
Original file line number Diff line number Diff line change
@@ -1,61 +1,65 @@
---
name: Developer image
on: # yamllint disable-line rule:truthy
push:
branches: [main]
paths-ignore:
- 'README.md'
- 'sample-config.conf'
- 'sample-config.yaml'
- '.github/**'

jobs:
check_versions:
name: Develop - Version checking
runs-on: ubuntu-latest
outputs:
version: ${{ steps.sogo.outputs.VERSION }}
steps:
- name: Get latest version of SOGo
id: sogo
run: |
echo "VERSION=$(curl -s https://api.github.com/repos/Alinto/sogo/releases/latest | jq -r '.tag_name' | sed 's/SOGo-//')" >> "$GITHUB_OUTPUT"
# Builds the Dockerfile and pushes it to dockerhub and GHCR
develop:
name: Develop - Docker image
needs: check_versions
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Docker - GHCR Login
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Docker - Metadata
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ github.repository }}
tags: type=raw,value=dev
flavor: latest=false

- name: Docker - Build / Push
uses: docker/build-push-action@v5
with:
platforms: linux/amd64
push: true
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
---
name: Developer image
on: # yamllint disable-line rule:truthy
push:
branches: [main]
paths-ignore:
- 'README.md'
- 'CODE_OF_CONDUCT.md'
- 'CONTRIBUTING.md'
- 'LICENSE'
- 'sample-config.conf'
- 'sample-config.yaml'
- '.github/**'
- 'charts/**'

jobs:
check_versions:
name: Develop - Version checking
runs-on: ubuntu-latest
outputs:
version: ${{ steps.sogo.outputs.VERSION }}
steps:
- name: Get latest version of SOGo
id: sogo
run: |
echo "VERSION=$(curl -s https://api.github.com/repos/Alinto/sogo/releases/latest | jq -r '.tag_name' | sed 's/SOGo-//')" >> "$GITHUB_OUTPUT"
# Builds the Dockerfile and pushes it to dockerhub and GHCR
develop:
name: Develop - Docker image
needs: check_versions
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Docker - GHCR Login
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Docker - Metadata
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ github.repository }}
tags: type=raw,value=dev
flavor: latest=false

- name: Docker - Build / Push
uses: docker/build-push-action@v5
with:
platforms: linux/amd64
push: true
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
SOGO_VERSION=${{ needs.check_versions.outputs.version }}
67 changes: 67 additions & 0 deletions .github/workflows/helm-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Release Charts
# only run one instance of this workflow at a time
# ref: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency
concurrency: chart_releaser

on:
workflow_call:
workflow_dispatch:

jobs:
release:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Fetch history
run: git fetch --prune --unshallow

- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: OCI - Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

# See https://github.com/helm/chart-releaser-action/issues/6
- name: Set up Helm
uses: azure/[email protected]
with:
version: v3.11.1

- name: Add dependency chart repos
run: |
helm repo add bitnami https://charts.bitnami.com/bitnami
- name: Run chart-releaser
uses: helm/[email protected]
with:
charts_dir: charts
pages_branch: gh-pages
mark_as_latest: false
skip_existing: true
config: ./charts/cr.yaml
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
CR_GENERATE_RELEASE_NOTES: true

- name: OCI Push to GHCR
run: |
if [ -z "$(ls -A .cr-release-packages)" ]; then
echo "No packages found under .cr-release-packages/"
exit 0
fi
for pkg in .cr-release-packages/*; do
if [ -z "${pkg:-}" ]; then
break
fi
REPO="${{ github.repository }}"
echo "Pushing $pkg to ghcr.io/${REPO,,}"
helm push "$pkg" "oci://ghcr.io/${REPO,,}"
done
52 changes: 52 additions & 0 deletions .github/workflows/helm-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Lint and Test Charts

on:
pull_request:
paths:
- 'charts/**'
- ct.yaml
paths-ignore:
- 'charts/**/README.md'

jobs:
lint-test:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install Helm
uses: azure/[email protected]
with:
version: v3.11.1

- name: Add dependency chart repos
run: |
helm repo add bitnami https://charts.bitnami.com/bitnami
- name: Set up chart-testing
uses: helm/[email protected]

- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed --target-branch ${{ github.event.repository.default_branch }} --config ct.yaml)
if [[ -n "$changed" ]]; then
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
- name: Run chart-testing (lint)
id: lint
if: steps.list-changed.outputs.changed == 'true'
run: ct lint --target-branch ${{ github.event.repository.default_branch }} --config ct.yaml

- name: Create kind cluster
uses: helm/[email protected]
if: steps.list-changed.outputs.changed == 'true'

- name: Run chart-testing (install)
id: install
if: steps.list-changed.outputs.changed == 'true'
run: ct install --target-branch ${{ github.event.repository.default_branch }} --config ct.yaml
Loading

0 comments on commit 4b09f11

Please sign in to comment.