Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manual release workflows #722

Merged
merged 12 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .github/workflows/pull_request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:
uses: actions/checkout@v4
with:
ref: ${{github.event.pull_request.head.sha}}
fetch-depth: 0

# Setting up helm binary
- name: Set up Helm
Expand All @@ -54,6 +55,13 @@ jobs:
check-latest: true
cache: true

# Get highest tag and remove any suffixes with '-'
- name: Get Highest tag
id: highest_tag
run: |
highest=$(git tag -l --sort -version:refname | head -n 1)
echo "tag=${highest%%-*}" >> $GITHUB_OUTPUT

- name: Install Dependencies
run: |
make install
Expand Down Expand Up @@ -139,7 +147,7 @@ jobs:
push: false
build-args: |
BUILD_PARAMETERS=${{ env.BUILD_PARAMETERS }}
BUILDER_IMAGE=${{ env.GHCR_IMAGE_REPOSITORY }}:${{ steps.generate_tag.outputs.GIT_TAG }}
BUILDER_IMAGE=${{ env.GHCR_IMAGE_REPOSITORY }}:${{ steps.highest_tag.outputs.tag }}
cache-to: type=inline
platforms: linux/amd64,linux/arm64
tags: |
Expand Down
11 changes: 1 addition & 10 deletions .github/workflows/pull_request_docs.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Pull Request for Documentation Changes

on:
pull_request_target:
pull_request:
branches:
- master
paths:
Expand All @@ -20,12 +20,3 @@ jobs:
MD_CONFIG: .github/md_config.json
DOC_SRC: docs
MD_LINT_CONFIG: .markdownlint.yaml
build:
uses: stakater/.github/.github/workflows/pull_request_container_build.yaml@v0.0.82
with:
DOCKER_FILE_PATH: Dockerfile-docs
secrets:
CONTAINER_REGISTRY_URL: ghcr.io/stakater/docs
CONTAINER_REGISTRY_USERNAME: stakater-user
CONTAINER_REGISTRY_PASSWORD: ${{ secrets.STAKATER_GITHUB_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.STAKATER_DELIVERY_SLACK_WEBHOOK }}
221 changes: 113 additions & 108 deletions .github/workflows/push.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
name: Push

on:
push:
pull_request:
types:
- closed
branches:
- master
paths:
- '**'
- '!.markdownlint.yaml'
- '!.vale.ini'
- '!Dockerfile-docs'
- '!docs-nginx.conf'
- '!docs/**'
- '!theme_common'
- '!theme_override'

env:
DOCKER_FILE_PATH: Dockerfile
Expand All @@ -25,7 +18,7 @@ env:
jobs:
build:
name: Build
if: "! contains(toJSON(github.event.commits.*.message), '[skip-ci]')"
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -81,15 +74,6 @@ jobs:
- name: Test
run: make test

- name: Generate Tag
id: generate_tag
uses: anothrNick/github-tag-action@1.70.0
env:
GITHUB_TOKEN: ${{ secrets.STAKATER_GITHUB_TOKEN }}
WITH_V: true
DEFAULT_BUMP: patch
DRY_RUN: true

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

Expand Down Expand Up @@ -117,7 +101,7 @@ jobs:
cache-to: type=inline
platforms: linux/amd64,linux/arm,linux/arm64
tags: |
${{ env.DOCKER_IMAGE_REPOSITORY }}:${{ steps.generate_tag.outputs.new_tag }}
${{ env.DOCKER_IMAGE_REPOSITORY }}:merge-${{ github.event.number }}
labels: |
org.opencontainers.image.source=${{ github.event.repository.clone_url }}
org.opencontainers.image.created=${{ steps.prep.outputs.created }}
Expand All @@ -132,11 +116,11 @@ jobs:
push: true
build-args: |
BUILD_PARAMETERS=${{ env.BUILD_PARAMETERS }}
BUILDER_IMAGE=${{ env.DOCKER_IMAGE_REPOSITORY }}:${{ steps.generate_tag.outputs.new_tag }}
BUILDER_IMAGE=${{ env.DOCKER_IMAGE_REPOSITORY }}:merge-${{ github.event.number }}
cache-to: type=inline
platforms: linux/amd64,linux/arm64
tags: |
${{ env.DOCKER_IMAGE_REPOSITORY }}:${{ steps.generate_tag.outputs.new_tag }}-ubi
${{ env.DOCKER_IMAGE_REPOSITORY }}:merge-${{ github.event.number }}-ubi
labels: |
org.opencontainers.image.source=${{ github.event.repository.clone_url }}
org.opencontainers.image.created=${{ steps.prep.outputs.created }}
Expand Down Expand Up @@ -164,7 +148,7 @@ jobs:
cache-to: type=inline
platforms: linux/amd64,linux/arm,linux/arm64
tags: |
${{ env.GHCR_IMAGE_REPOSITORY }}:${{ steps.generate_tag.outputs.new_tag }}
${{ env.GHCR_IMAGE_REPOSITORY }}:merge-${{ github.event.number }}
labels: |
org.opencontainers.image.source=${{ github.event.repository.clone_url }}
org.opencontainers.image.created=${{ steps.prep.outputs.created }}
Expand All @@ -179,11 +163,44 @@ jobs:
push: true
build-args: |
BUILD_PARAMETERS=${{ env.BUILD_PARAMETERS }}
BUILDER_IMAGE=${{ env.GHCR_IMAGE_REPOSITORY }}:${{ steps.generate_tag.outputs.new_tag }}
BUILDER_IMAGE=${{ env.GHCR_IMAGE_REPOSITORY }}:merge-${{ github.event.number }}
cache-to: type=inline
platforms: linux/amd64,linux/arm64
tags: |
${{ env.GHCR_IMAGE_REPOSITORY }}:${{ steps.generate_tag.outputs.new_tag }}-ubi
${{ env.GHCR_IMAGE_REPOSITORY }}:merge-${{ github.event.number }}-ubi
labels: |
org.opencontainers.image.source=${{ github.event.repository.clone_url }}
org.opencontainers.image.created=${{ steps.prep.outputs.created }}
org.opencontainers.image.revision=${{ github.sha }}

- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
docs:
- '.markdownlint.yaml'
- '.vale.ini'
- 'Dockerfile-docs'
- 'docs-nginx.conf'
- 'docs/**'
- 'README.md'
- 'theme_common'
- 'theme_override'

# run only if 'docs' files were changed
- name: Build and Push Docker Image for Docs to ghcr registry
if: steps.filter.outputs.docs == 'true'
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile-docs
pull: true
push: true
build-args: BUILD_PARAMETERS=${{ env.BUILD_PARAMETERS }}
cache-to: type=inline
platforms: linux/amd64,linux/arm,linux/arm64
tags: |
${{ env.GHCR_IMAGE_REPOSITORY }}/docs:merge-${{ github.event.number }}
labels: |
org.opencontainers.image.source=${{ github.event.repository.clone_url }}
org.opencontainers.image.created=${{ steps.prep.outputs.created }}
Expand All @@ -193,90 +210,78 @@ jobs:
## Add steps to generate required artifacts for a release here(helm chart, operator manifest etc.)
##############################

# Generate tag for operator without "v"
- name: Generate Operator Tag
id: generate_operator_tag
uses: anothrNick/github-tag-action@1.70.0
env:
GITHUB_TOKEN: ${{ secrets.STAKATER_GITHUB_TOKEN }}
WITH_V: false
DEFAULT_BUMP: patch
DRY_RUN: true
# Skip pushing plain manifests till we decide what to do with them

# Update chart tag to the latest semver tag
- name: Update Chart Version
env:
VERSION: ${{ steps.generate_operator_tag.outputs.new_tag }}
run: make bump-chart

- name: Helm Template
run: |
helm template reloader deployments/kubernetes/chart/reloader/ \
--set-string reloader.deployment.resources.limits.cpu=1 \
--set reloader.deployment.resources.limits.memory=128Mi \
--set reloader.deployment.resources.requests.cpu=10m \
--set reloader.deployment.resources.requests.memory=128Mi > deployments/kubernetes/reloader.yaml
# - name: Helm Template
# run: |
# helm template reloader deployments/kubernetes/chart/reloader/ \
# --set reloader.deployment.resources.limits.cpu=150m \
# --set reloader.deployment.resources.limits.memory=512Mi \
# --set reloader.deployment.resources.requests.cpu=10m \
# --set reloader.deployment.resources.requests.memory=128Mi > deployments/kubernetes/reloader.yaml

helm template reloader deployments/kubernetes/chart/reloader/ --output-dir deployments/kubernetes/manifests && mv deployments/kubernetes/manifests/reloader/templates/* deployments/kubernetes/manifests/ && rm -r deployments/kubernetes/manifests/reloader

- name: Remove labels and annotations from manifests
run: make remove-labels-annotations

# Publish helm chart
- name: Login to ghcr via helm
run: |
echo ${{secrets.GITHUB_TOKEN}} | helm registry login ghcr.io/stakater --username stakater-user --password-stdin

- name: Publish Helm chart to ghcr.io
run: |
helm package ./deployments/kubernetes/chart/reloader --destination ./packaged-chart
helm push ./packaged-chart/*.tgz oci://ghcr.io/stakater/charts
rm -rf ./packaged-chart

- name: Publish Helm chart to gh-pages
uses: stefanprodan/helm-gh-pages@master
with:
branch: master
repository: stakater-charts
target_dir: docs
token: ${{ secrets.STAKATER_GITHUB_TOKEN }}
charts_dir: deployments/kubernetes/chart/
charts_url: ${{ env.HELM_REGISTRY_URL }}
owner: stakater
linting: on
commit_username: stakater-user
commit_email: stakater@gmail.com

# Commit back changes
- name: Log info about `.git` directory permissions
run: |
# Debug logging
echo "Disk usage: "
df -H

echo ".git files not owned by current user or current group:"
find .git ! -user $(id -u) -o ! -group $(id -g) | xargs ls -lah

- name: Commit files
run: |
git config --local user.email "stakater@gmail.com"
git config --local user.name "stakater-user"
git status
git add .
git commit -m "[skip-ci] Update artifacts" -a

- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.STAKATER_GITHUB_TOKEN }}
branch: ${{ github.ref }}

- name: Push Latest Tag
uses: anothrNick/github-tag-action@1.70.0
env:
GITHUB_TOKEN: ${{ secrets.STAKATER_GITHUB_TOKEN }}
WITH_V: true
DEFAULT_BUMP: patch
# helm template reloader deployments/kubernetes/chart/reloader/ --output-dir deployments/kubernetes/manifests && mv deployments/kubernetes/manifests/reloader/templates/* deployments/kubernetes/manifests/ && rm -r deployments/kubernetes/manifests/reloader

# - name: Remove labels and annotations from manifests
# run: make remove-labels-annotations

# Charts are to be pushed to a separate repo with a separate release cycle

# # Publish helm chart
# - name: Login to ghcr via helm
# run: |
# echo ${{secrets.GITHUB_TOKEN}} | helm registry login ghcr.io/stakater --username stakater-user --password-stdin

# - name: Publish Helm chart to ghcr.io
# run: |
# helm package ./deployments/kubernetes/chart/reloader --destination ./packaged-chart
# helm push ./packaged-chart/*.tgz oci://ghcr.io/stakater/charts
# rm -rf ./packaged-chart

# - name: Publish Helm chart to gh-pages
# uses: stefanprodan/helm-gh-pages@master
# with:
# branch: master
# repository: stakater-charts
# target_dir: docs
# token: ${{ secrets.STAKATER_GITHUB_TOKEN }}
# charts_dir: deployments/kubernetes/chart/
# charts_url: ${{ env.HELM_REGISTRY_URL }}
# owner: stakater
# linting: on
# commit_username: stakater-user
# commit_email: stakater@gmail.com

# # Commit back changes
# - name: Log info about `.git` directory permissions
# run: |
# # Debug logging
# echo "Disk usage: "
# df -H

# echo ".git files not owned by current user or current group:"
# find .git ! -user $(id -u) -o ! -group $(id -g) | xargs ls -lah

# - name: Commit files
# run: |
# git config --local user.email "stakater@gmail.com"
# git config --local user.name "stakater-user"
# git status
# git add .
# git commit -m "[skip-ci] Update artifacts" -a

# - name: Push changes
# uses: ad-m/github-push-action@master
# with:
# github_token: ${{ secrets.STAKATER_GITHUB_TOKEN }}
# branch: ${{ github.ref }}

# - name: Push Latest Tag
# uses: anothrNick/github-tag-action@1.70.0
# env:
# GITHUB_TOKEN: ${{ secrets.STAKATER_GITHUB_TOKEN }}
# WITH_V: true
# DEFAULT_BUMP: patch

- name: Notify Slack
uses: 8398a7/action-slack@v3
Expand Down
28 changes: 0 additions & 28 deletions .github/workflows/push_docs.yaml

This file was deleted.

Loading
Loading