Skip to content

Commit

Permalink
update version and modify pipelines
Browse files Browse the repository at this point in the history
  • Loading branch information
mabulgu committed Nov 21, 2023
1 parent c5e372f commit 0264002
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 73 deletions.
14 changes: 0 additions & 14 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,3 @@ jobs:
- name: Build
run: make build

upload_build_data_artifact:
runs-on: ubuntu-latest
needs: build
steps:
- name: Write image version
run: |
printf '{
"image_version": "19.0.0"
}' >> build_data.json
- uses: actions/upload-artifact@v3
with:
name: build_data.json
path: ./
112 changes: 64 additions & 48 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,64 +5,80 @@ name: Deploy

on:
release:
types: [published]
types: [ published ]

jobs:
deploy:

runs-on: ubuntu-latest

outputs:
version: ${{ steps.get_version.outputs.STRIMZI_CLI_VERSION }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2
- name: Get release version
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV

- name: Get release version
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Get code version
id: get_version
run: echo "STRIMZI_CLI_VERSION=$(grep -m 1 'version' pyproject.toml | cut -d '=' -f 2 | xargs)" >> $GITHUB_ENV

- name: Get code version
run: echo "STRIMZI_CLI_VERSION=$(grep -m 1 'version' pyproject.toml | cut -d '=' -f 2 | xargs)" >> $GITHUB_ENV
- name: Compare release and code version
if: ${{ env.RELEASE_VERSION != env.STRIMZI_CLI_VERSION }}
run: exit 1

- name: Compare release and code version
if: ${{ env.RELEASE_VERSION != env.STRIMZI_CLI_VERSION }}
run: exit 1
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
run: make install-dependencies

- name: Install dependencies
run: make install-dependencies
- name: Build
run: make build

- name: Build
run: make build
- name: Publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
twine upload dist/*
continue-on-error: true
- name: Sleep for 3 mins
uses: jakejarvis/wait-action@master
with:
time: '180s'
- name: Bake and push image
uses: docker/build-push-action@v1.1.0
with:
# Username used to log in to a Docker registry. If not set then no login will occur
username: ${{ secrets.QUAY_USERNAME }}
# Password or personal access token used to log in to a Docker registry. If not set then no login will occur
password: ${{ secrets.QUAY_PASSWORD }}
# Server address of Docker registry. If not set then will default to Docker Hub
registry: quay.io
# Docker repository to tag the image with
repository: systemcraftsman/strimzi-kafka-cli
# Comma-delimited list of tags. These will be added to the registry/repository to form the image's tags
tags: latest,${{ env.STRIMZI_CLI_VERSION }}
# Path to the build context
path: .
# Path to the Dockerfile (Default is '{path}/Dockerfile')
dockerfile: ./Dockerfile
# Whether to push the image
push: true

- name: Publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
twine upload dist/*
continue-on-error: true
- name: Sleep for 3 mins
uses: jakejarvis/wait-action@master
with:
time: '180s'
- name: Bake and push image
uses: docker/build-push-action@v1.1.0
with:
# Username used to log in to a Docker registry. If not set then no login will occur
username: ${{ secrets.QUAY_USERNAME }}
# Password or personal access token used to log in to a Docker registry. If not set then no login will occur
password: ${{ secrets.QUAY_PASSWORD }}
# Server address of Docker registry. If not set then will default to Docker Hub
registry: quay.io
# Docker repository to tag the image with
repository: systemcraftsman/strimzi-kafka-cli
# Comma-delimited list of tags. These will be added to the registry/repository to form the image's tags
tags: latest,${{ env.STRIMZI_CLI_VERSION }}
# Path to the build context
path: .
# Path to the Dockerfile (Default is '{path}/Dockerfile')
dockerfile: ./Dockerfile
# Whether to push the image
push: true
upload_build_data_artifact:
runs-on: ubuntu-latest
needs: deploy
steps:
- name: Write version
run: |
printf '{
"version": ${{ needs.deploy.outputs.version }}
}' >> build_data.json
- uses: actions/upload-artifact@v3
with:
name: build_data.json
path: ./
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Create Ops PR
name: Post-Deploy
on:
workflow_run:
workflows:
- Build
- Deploy
branches:
- main
types:
Expand Down Expand Up @@ -49,32 +49,34 @@ jobs:
outputs:
image_version: ${{ fromJSON(steps.return-parsed-json.outputs.result).image_version }}

create_pr:
create_pr_on_brew_repo:
runs-on: ubuntu-20.04
needs: download_build_data_artifact

permissions:
contents: write

steps:
- name: Checkout Ops repo
- name: Checkout Homebrew repo
uses: actions/checkout@v4
with:
repository: SystemCraftsman/homebrew-strimzi-kafka-cli
ref: refs/heads/master
token: ${{ secrets.GH_PAT }}
token: ${{ secrets.GITHUB_TOKEN }}

- name: Apply changes
run: |
echo "${{ needs.download_build_data_artifact.outputs.image_version }}" > test.txt
version="$(sed -n 's/version \"\(.*\)\"/\1/p' strimzi-kafka-cli.rb | sed -e 's/^[[:space:]]*//')"
sed -i -e "s/$version/${{ needs.download_build_data_artifact.outputs.image_version }}/g" strimzi-kafka-cli.rb
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GH_PAT }}
commit-message: Update image tag and revision for prod upgrade
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Update to version ${{ needs.download_build_data_artifact.outputs.image_version }}
committer: GitHub <noreply@github.com>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
branch: prod-upgrade-${{ needs.download_build_data_artifact.outputs.image_version }}
branch: version-update-${{ needs.download_build_data_artifact.outputs.image_version }}
assignees: mabulgu
reviewers: mabulgu
title: '[Automated PR] Update image tag and revision for prod upgrade'
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM python:3.11.6-alpine
USER root
RUN adduser -D kfkuser
RUN pip install strimzi-kafka-cli==0.1.0a70
RUN pip install strimzi-kafka-cli==0.1.0a71
USER kfkuser
RUN kfk --version
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "strimzi-kafka-cli"
version = "0.1.0-alpha70"
version = "0.1.0-alpha71"
description = "Command Line Interface for Strimzi Kafka Operator"
authors = [{ name = "Aykut Bulgu", email = "aykut@systemcraftsman.com" }]
readme = "README.md"
Expand Down

0 comments on commit 0264002

Please sign in to comment.