Skip to content

Update

Update #35

Workflow file for this run

name: Update
env:
IMAGE_NAME: activemq-artemis-broker-kubernetes
on:
workflow_dispatch:
inputs:
version:
description: 'Version, i.e. 1.0.0'
required: false
default: '*.*.+'
type: string
update_version:
description: 'Update version'
required: true
default: true
type: boolean
base_image:
description: 'Base image'
required: false
default: 'latest'
type: string
update_base_image:
description: 'Update base image'
required: true
default: true
type: boolean
trigger_release:
description: 'Trigger release'
required: false
default: 'this'
type: choice
options:
- none
- this
- all
jobs:
update:
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
uses: actions/checkout@v4
- name: Set up the repo
run: |
git config user.name 'artemiscloud-bot'
git config user.email 'bot@artemiscloud.io'
git push
- name: Update version
if: ${{ inputs.update_version }}
run: |
CURRENT_VERSION=$(grep -m 1 -oP '(?<=^version: ")[^"]+' image.yaml)
IFS=. read CURRENT_VERSION_MAJOR CURRENT_VERSION_MINOR CURRENT_VERSION_PATCH <<< ${CURRENT_VERSION}
IFS=. read VERSION_MAJOR VERSION_MINOR VERSION_PATCH <<< ${{ inputs.version }}
VERSION_MAJOR=${VERSION_MAJOR/\*/${CURRENT_VERSION_MAJOR}} && VERSION_MAJOR=${VERSION_MAJOR/+/$((CURRENT_VERSION_MAJOR+1))}
VERSION_MINOR=${VERSION_MINOR/\*/${CURRENT_VERSION_MINOR}} && VERSION_MINOR=${VERSION_MINOR/+/$((CURRENT_VERSION_MINOR+1))}
VERSION_PATCH=${VERSION_PATCH/\*/${CURRENT_VERSION_PATCH}} && VERSION_PATCH=${VERSION_PATCH/+/$((CURRENT_VERSION_PATCH+1))}
VERSION="${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}"
sed -i "s~^version:.*~version: \"${VERSION}\"~g" image.yaml
git commit --all --message "Update version to ${VERSION}" || echo "nothing to commit"
- name: Update base image
if: ${{ inputs.update_base_image }}
run: |
if [ "${{ inputs.base_image }}" = "latest" ]; then
BASE_IMAGE="quay.io/${{ secrets.QUAY_NAMESPACE }}/activemq-artemis-broker@$(skopeo inspect docker://quay.io/${{ secrets.QUAY_NAMESPACE }}/activemq-artemis-broker:latest | jq -r '.Digest')"
else
BASE_IMAGE="${{ inputs.base_image }}"
fi
sed -i "s~from.*~from: \"${BASE_IMAGE}\"~g" image.yaml
git commit --all --message "Update base image to ${BASE_IMAGE}" || echo "nothing to commit"
- name: Update netty-tcnative
run: |
BASE_IMAGE="$(grep -Po -m 1 '(?<=^from: ")[^"]+' image.yaml)"
APACHE_ARTEMIS_VERSION=$(skopeo inspect docker://${BASE_IMAGE} | grep -Po '(?<=APACHE_ARTEMIS_VERSION=)[^"]*')
wget -O netty-pom.xml "https://raw.githubusercontent.com/apache/activemq-artemis/${APACHE_ARTEMIS_VERSION}/pom.xml"
NETTY_TCNATIVE_VERSION=$(grep -Po '(?<=tcnative.version>)[^<]+' netty-pom.xml)
NETTY_TCNATIVE_CLASSES_URL="https://repo1.maven.org/maven2/io/netty/netty-tcnative-classes/${NETTY_TCNATIVE_VERSION}/netty-tcnative-classes-${NETTY_TCNATIVE_VERSION}.jar"
NETTY_TCNATIVE_CLASSES_TARGET=$(basename ${NETTY_TCNATIVE_CLASSES_URL})
wget -O ${NETTY_TCNATIVE_CLASSES_TARGET} "${NETTY_TCNATIVE_CLASSES_URL}"
NETTY_TCNATIVE_CLASSES_MD5=($(md5sum ${NETTY_TCNATIVE_CLASSES_TARGET}))
sed -i "/name: netty-tcnative-classes/,/md5:/ s~target:.*~target: ${NETTY_TCNATIVE_CLASSES_TARGET}~" modules/activemq-artemis-launch/module.yaml
sed -i "/name: netty-tcnative-classes/,/md5:/ s~url:.*~url: ${NETTY_TCNATIVE_CLASSES_URL}~" modules/activemq-artemis-launch/module.yaml
sed -i "/name: netty-tcnative-classes/,/md5:/ s~md5:.*~md5: ${NETTY_TCNATIVE_CLASSES_MD5}~" modules/activemq-artemis-launch/module.yaml
NETTY_TCNATIVE_INDEX=0
for NETTY_TCNATIVE_QUALIFIER in 'linux-x86_64' 'linux-aarch_64' 'osx-x86_64' 'windows-x86_64'; do
NETTY_TCNATIVE_URL="https://repo1.maven.org/maven2/io/netty/netty-tcnative-boringssl-static/${NETTY_TCNATIVE_VERSION}/netty-tcnative-boringssl-static-${NETTY_TCNATIVE_VERSION}-${NETTY_TCNATIVE_QUALIFIER}.jar"
NETTY_TCNATIVE_TARGET=$(basename ${NETTY_TCNATIVE_URL})
wget -O ${NETTY_TCNATIVE_TARGET} "${NETTY_TCNATIVE_URL}"
NETTY_TCNATIVE_MD5=($(md5sum ${NETTY_TCNATIVE_TARGET}))
sed -i "/name: netty-tcnative-${NETTY_TCNATIVE_INDEX}/,/md5:/ s~target:.*~target: ${NETTY_TCNATIVE_TARGET}~" modules/activemq-artemis-launch/module.yaml
sed -i "/name: netty-tcnative-${NETTY_TCNATIVE_INDEX}/,/md5:/ s~url:.*~url: ${NETTY_TCNATIVE_URL}~" modules/activemq-artemis-launch/module.yaml
sed -i "/name: netty-tcnative-${NETTY_TCNATIVE_INDEX}/,/md5:/ s~md5:.*~md5: ${NETTY_TCNATIVE_MD5}~" modules/activemq-artemis-launch/module.yaml
NETTY_TCNATIVE_INDEX=$((NETTY_TCNATIVE_INDEX + 1))
done
git commit --all --message "Upgrade netty-tcnative to ${NETTY_TCNATIVE_VERSION}" || echo "Nothing to commit"
- name: Push commits
run: |
git push
- name: Trigger release
if: ${{ inputs.trigger_release != 'none' }}
uses: actions/github-script@v7
with:
github-token: ${{ secrets.BOT_TOKEN }}
script: |
const trigger_children = (context.payload.inputs.trigger_release === 'all' ? 'true' : 'false')
await github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'release.yml',
ref: context.ref,
inputs: {
trigger_children: trigger_children
}
});