Skip to content

Commit

Permalink
Fix release pipeline (#628)
Browse files Browse the repository at this point in the history
* move release pipeline to main
* update chart versions
* fix helm chart unit test
  • Loading branch information
ekneg54 committed Jun 27, 2024
1 parent e6b8838 commit 1ef1b78
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 51 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,28 @@ jobs:

- name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@v2

helm-charts:
# you have to update the `charts/logprep/Chart.yaml` versions to trigger a new release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: main

- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: Install Helm
uses: azure/setup-helm@v4
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

- name: Run chart-releaser
uses: helm/chart-releaser-action@v1.6.0
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
48 changes: 0 additions & 48 deletions .github/workflows/publish-release-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,51 +80,3 @@ jobs:
ghcr.io/fkie-cad/logprep:py${{ matrix.python-version }}-${{ github.ref_name }}
ghcr.io/fkie-cad/logprep:py${{ matrix.python-version }}-stable
ghcr.io/fkie-cad/logprep:py${{ matrix.python-version }}-latest
helm-charts:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: main

- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: Install Helm
uses: azure/setup-helm@v4
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

- name: template Chart.yaml
env:
LOGPREP_VERSION: ${{ github.ref_name }}
run: |
sed "s/{{ LOGPREP_VERSION }}/$LOGPREP_VERSION/g" charts/logprep/Chart.yaml.j2 > ./charts/logprep/Chart.yaml
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Update Logprep chart versions
branch: main
# Optional glob pattern of files which should be added to the commit
# Defaults to all (.)
# See the `pathspec`-documentation for git
# - https://git-scm.com/docs/git-add#Documentation/git-add.txt-ltpathspecgt82308203
# - https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefpathspecapathspec
file_pattern: "charts/logprep/Chart.yaml"

- name: update release tag
uses: rickstaa/action-create-tag@v1
id: "tag_update"
with:
tag: ${{ github.ref_name }}
force_push_tag: true

- name: Run chart-releaser
uses: helm/chart-releaser-action@v1.6.0
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
4 changes: 2 additions & 2 deletions charts/logprep/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: "1.0.0"
version: "13.0.0"

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "12.0.0"
appVersion: "13.0.0"
8 changes: 7 additions & 1 deletion tests/unit/charts/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# pylint: disable=attribute-defined-outside-init
# pylint: disable=protected-access

import re
import subprocess
from tempfile import NamedTemporaryFile
from typing import Dict, Optional
Expand Down Expand Up @@ -68,7 +69,6 @@ def test_labels_are_set(self):
@pytest.mark.parametrize(
"label, label_value",
[
("app.kubernetes.io/version", "12.0.0"),
("app.kubernetes.io/name", "logprep-logprep"),
("app.kubernetes.io/application", "logprep"),
("app.kubernetes.io/managed-by", "Helm"),
Expand All @@ -78,3 +78,9 @@ def test_labels_are_set(self):
def test_common_labels_are_set(self, label, label_value):
for manifest in self.manifests:
assert manifest["metadata.labels"][label] == label_value

def test_chart_version_is_set(self):
for manifest in self.manifests:
assert re.search(
r"\d+\.\d+\.\d+", manifest["metadata.labels"]["app.kubernetes.io/version"]
)

0 comments on commit 1ef1b78

Please sign in to comment.