mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-10 15:16:56 +00:00
fix: docker image build and helm chart publish error caused by versio… (#2731)
This commit is contained in:
@@ -22,9 +22,6 @@ on:
|
|||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
env:
|
|
||||||
new_version: ${{ github.event.workflow_run.head_branch }}
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-helm-package:
|
build-helm-package:
|
||||||
runs-on: ubicloud-standard-2
|
runs-on: ubicloud-standard-2
|
||||||
@@ -34,16 +31,47 @@ jobs:
|
|||||||
github.event.workflow_run.event == 'push' &&
|
github.event.workflow_run.event == 'push' &&
|
||||||
contains(github.event.workflow_run.head_branch, '.')
|
contains(github.event.workflow_run.head_branch, '.')
|
||||||
|
|
||||||
|
outputs:
|
||||||
|
raw_tag: ${{ steps.version.outputs.raw_tag }}
|
||||||
|
version: ${{ steps.version.outputs.version }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout helm chart repo
|
- name: Checkout helm chart repo
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
|
- name: Normalize release version
|
||||||
|
id: version
|
||||||
|
run: |
|
||||||
|
set -eux
|
||||||
|
|
||||||
|
RAW="${{ github.event.workflow_run.head_branch }}"
|
||||||
|
|
||||||
|
case "$RAW" in
|
||||||
|
refs/tags/*)
|
||||||
|
RAW_TAG="${RAW#refs/tags/}"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
RAW_TAG="$RAW"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
VERSION="$RAW_TAG"
|
||||||
|
case "$VERSION" in
|
||||||
|
v*)
|
||||||
|
VERSION="${VERSION#v}"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
echo "raw_tag=$RAW_TAG" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
echo "raw_tag=$RAW_TAG"
|
||||||
|
echo "version=$VERSION"
|
||||||
|
|
||||||
- name: Replace chart app version
|
- name: Replace chart app version
|
||||||
run: |
|
run: |
|
||||||
set -e
|
set -eux
|
||||||
set -x
|
sed -i -E 's/^appVersion:.*/appVersion: "${{ steps.version.outputs.version }}"/' helm/rustfs/Chart.yaml
|
||||||
old_version=$(grep "^appVersion:" helm/rustfs/Chart.yaml | awk '{print $2}')
|
|
||||||
sed -i "s/$old_version/$new_version/g" helm/rustfs/Chart.yaml
|
|
||||||
|
|
||||||
- name: Set up Helm
|
- name: Set up Helm
|
||||||
uses: azure/setup-helm@v4.3.0
|
uses: azure/setup-helm@v4.3.0
|
||||||
@@ -51,8 +79,9 @@ jobs:
|
|||||||
- name: Package Helm Chart
|
- name: Package Helm Chart
|
||||||
run: |
|
run: |
|
||||||
cp helm/README.md helm/rustfs/
|
cp helm/README.md helm/rustfs/
|
||||||
package_version=$(echo $new_version | awk -F '-' '{print $2}' | awk -F '.' '{print $NF}')
|
helm package ./helm/rustfs \
|
||||||
helm package ./helm/rustfs --destination helm/rustfs/ --version "0.0.$package_version"
|
--destination helm/rustfs/ \
|
||||||
|
--version "${{ steps.version.outputs.version }}"
|
||||||
|
|
||||||
- name: Upload helm package as artifact
|
- name: Upload helm package as artifact
|
||||||
uses: actions/upload-artifact@v6
|
uses: actions/upload-artifact@v6
|
||||||
@@ -64,6 +93,7 @@ jobs:
|
|||||||
publish-helm-package:
|
publish-helm-package:
|
||||||
runs-on: ubicloud-standard-2
|
runs-on: ubicloud-standard-2
|
||||||
needs: [ build-helm-package ]
|
needs: [ build-helm-package ]
|
||||||
|
if: needs.build-helm-package.result == 'success'
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout helm package repo
|
- name: Checkout helm package repo
|
||||||
@@ -90,5 +120,5 @@ jobs:
|
|||||||
git config --global user.email "${{ secrets.EMAIL_ADDRESS }}"
|
git config --global user.email "${{ secrets.EMAIL_ADDRESS }}"
|
||||||
git status .
|
git status .
|
||||||
git add .
|
git add .
|
||||||
git commit -m "Update rustfs helm package with $new_version."
|
git commit -m "Update rustfs helm package with ${{ needs.build-helm-package.outputs.version }}."
|
||||||
git push origin main
|
git push origin main
|
||||||
|
|||||||
+12
@@ -29,8 +29,20 @@ RUN set -eux; \
|
|||||||
if [ "$RELEASE" = "latest" ]; then \
|
if [ "$RELEASE" = "latest" ]; then \
|
||||||
TAG="$(curl -fsSL https://api.github.com/repos/rustfs/rustfs/releases \
|
TAG="$(curl -fsSL https://api.github.com/repos/rustfs/rustfs/releases \
|
||||||
| grep -o '"tag_name": "[^"]*"' | cut -d'"' -f4 | head -n 1)"; \
|
| grep -o '"tag_name": "[^"]*"' | cut -d'"' -f4 | head -n 1)"; \
|
||||||
|
RELEASE_JSON="$(curl -fsSL "https://api.github.com/repos/rustfs/rustfs/releases/tags/$TAG")"; \
|
||||||
else \
|
else \
|
||||||
TAG="$RELEASE"; \
|
TAG="$RELEASE"; \
|
||||||
|
RELEASE_JSON="$(curl -fsSL "https://api.github.com/repos/rustfs/rustfs/releases/tags/$TAG" 2>/dev/null || true)"; \
|
||||||
|
if [ -z "$RELEASE_JSON" ]; then \
|
||||||
|
if [ "${TAG#v}" = "$TAG" ]; then \
|
||||||
|
ALT_TAG="v$TAG"; \
|
||||||
|
else \
|
||||||
|
ALT_TAG="${TAG#v}"; \
|
||||||
|
fi; \
|
||||||
|
echo "Primary tag lookup failed, retrying with alternate tag: $ALT_TAG"; \
|
||||||
|
RELEASE_JSON="$(curl -fsSL "https://api.github.com/repos/rustfs/rustfs/releases/tags/$ALT_TAG")"; \
|
||||||
|
TAG="$ALT_TAG"; \
|
||||||
|
fi; \
|
||||||
fi; \
|
fi; \
|
||||||
echo "Using tag: $TAG (arch pattern: $ARCH_SUBSTR)"; \
|
echo "Using tag: $TAG (arch pattern: $ARCH_SUBSTR)"; \
|
||||||
# Find download URL in assets list for this tag that contains arch substring and ends with .zip
|
# Find download URL in assets list for this tag that contains arch substring and ends with .zip
|
||||||
|
|||||||
+13
-2
@@ -31,14 +31,25 @@ RUN set -eux; \
|
|||||||
arm64) ARCH_SUBSTR="aarch64-gnu" ;; \
|
arm64) ARCH_SUBSTR="aarch64-gnu" ;; \
|
||||||
*) echo "Unsupported TARGETARCH=$TARGETARCH" >&2; exit 1 ;; \
|
*) echo "Unsupported TARGETARCH=$TARGETARCH" >&2; exit 1 ;; \
|
||||||
esac; \
|
esac; \
|
||||||
\
|
|
||||||
if [ "$RELEASE" = "latest" ]; then \
|
if [ "$RELEASE" = "latest" ]; then \
|
||||||
TAG="$(curl -fsSL https://api.github.com/repos/rustfs/rustfs/releases \
|
TAG="$(curl -fsSL https://api.github.com/repos/rustfs/rustfs/releases \
|
||||||
| grep -o '"tag_name": "[^"]*"' | cut -d'"' -f4 | head -n 1)"; \
|
| grep -o '"tag_name": "[^"]*"' | cut -d'"' -f4 | head -n 1)"; \
|
||||||
|
RELEASE_JSON="$(curl -fsSL "https://api.github.com/repos/rustfs/rustfs/releases/tags/$TAG")"; \
|
||||||
else \
|
else \
|
||||||
TAG="$RELEASE"; \
|
TAG="$RELEASE"; \
|
||||||
|
RELEASE_JSON="$(curl -fsSL "https://api.github.com/repos/rustfs/rustfs/releases/tags/$TAG" 2>/dev/null || true)"; \
|
||||||
|
if [ -z "$RELEASE_JSON" ]; then \
|
||||||
|
if [ "${TAG#v}" = "$TAG" ]; then \
|
||||||
|
ALT_TAG="v$TAG"; \
|
||||||
|
else \
|
||||||
|
ALT_TAG="${TAG#v}"; \
|
||||||
|
fi; \
|
||||||
|
echo "Primary tag lookup failed, retrying with alternate tag: $ALT_TAG"; \
|
||||||
|
RELEASE_JSON="$(curl -fsSL "https://api.github.com/repos/rustfs/rustfs/releases/tags/$ALT_TAG")"; \
|
||||||
|
TAG="$ALT_TAG"; \
|
||||||
|
fi; \
|
||||||
fi; \
|
fi; \
|
||||||
\
|
echo "Using tag: $TAG (arch pattern: $ARCH_SUBSTR)"; \
|
||||||
URL="$(curl -fsSL "https://api.github.com/repos/rustfs/rustfs/releases/tags/$TAG" \
|
URL="$(curl -fsSL "https://api.github.com/repos/rustfs/rustfs/releases/tags/$TAG" \
|
||||||
| grep -o "\"browser_download_url\": \"[^\"]*${ARCH_SUBSTR}[^\"]*\\.zip\"" \
|
| grep -o "\"browser_download_url\": \"[^\"]*${ARCH_SUBSTR}[^\"]*\\.zip\"" \
|
||||||
| cut -d'"' -f4 | head -n 1)"; \
|
| cut -d'"' -f4 | head -n 1)"; \
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ apiVersion: v2
|
|||||||
name: rustfs
|
name: rustfs
|
||||||
description: RustFS helm chart to deploy RustFS on kubernetes cluster.
|
description: RustFS helm chart to deploy RustFS on kubernetes cluster.
|
||||||
type: application
|
type: application
|
||||||
version: "v1.0.0-beta.1"
|
version: "1.0.0-beta.1"
|
||||||
appVersion: "v1.0.0-beta.1"
|
appVersion: "1.0.0-beta.1"
|
||||||
home: https://rustfs.com
|
home: https://rustfs.com
|
||||||
icon: https://media.sys.truenas.net/apps/rustfs/icons/icon.svg
|
icon: https://media.sys.truenas.net/apps/rustfs/icons/icon.svg
|
||||||
maintainers:
|
maintainers:
|
||||||
|
|||||||
Reference in New Issue
Block a user