-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: joyceliu <[email protected]>
- Loading branch information
1 parent
3521c32
commit 91a4bf3
Showing
4 changed files
with
125 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
name: BuildExtensionsMuseum | ||
|
||
on: | ||
workflow_dispatch: # Manual trigger | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- 'v*' | ||
|
||
jobs: | ||
build-multiarch: | ||
runs-on: ubuntu-latest | ||
if: github.repository == 'kubesphere-extensions/ks-extensions' | ||
steps: | ||
- name: Prepare | ||
id: prepare | ||
run: | | ||
VERSION=latest | ||
if [[ $GITHUB_REF == refs/tags/* ]]; then | ||
VERSION=${GITHUB_REF#refs/tags/} | ||
fi | ||
echo "version=${VERSION}" >> "$GITHUB_OUTPUT" | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Login to Aliyun | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: registry.cn-beijing.aliyuncs.com | ||
username: ${{ secrets.ALIYUNCS_USERNAME }} | ||
password: ${{ secrets.ALIYUNCS_PASSWORD }} | ||
|
||
- name: Login to DOCKER | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Build and push Docker images | ||
run: | | ||
ARCH=$(uname -m) | ||
if [ "$ARCH" == "x86_64" ]; then | ||
ARCH="amd64" | ||
elif [ "$ARCH" == "aarch64" ]; then | ||
ARCH="arm64" | ||
fi | ||
# package to charts use ksbuilder | ||
LATEST_RELEASE=$(curl -sH "Accept: application/vnd.github.v3+json" "https://api.github.com/repos/kubesphere/ksbuilder/releases/latest" | jq -r '.tag_name') | ||
KSBUILDER_VERSION=$LATEST_RELEASE;ARCH=$ARCH make package-all-charts | ||
- name: Build and push ks-controller-manager dev images | ||
uses: docker/build-push-action@v6 | ||
if: steps.chose_registry.outputs.env == 'dev' | ||
with: | ||
context: ${{ github.workspace }} | ||
platforms: linux/amd64,linux/arm64 | ||
push: true | ||
tags: | | ||
docker.io/kubesphere/extensions-museum:${{ steps.prepare.outputs.version }} | ||
registry.cn-beijing.aliyuncs.com/kubesphereio/extensions-museum:${{ steps.prepare.outputs.version }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
.idea | ||
/bin/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM docker.io/kubesphere/extensions-museum:latest as base | ||
|
||
COPY bin/_output/ /charts/ | ||
|
||
ENTRYPOINT ["/chartmuseum","--storage.local.rootdir","/charts"] | ||
|
||
FROM ghcr.io/helm/chartmuseum:v0.16.1 | ||
|
||
COPY --from=base /charts/ /charts/ | ||
|
||
ENTRYPOINT ["/chartmuseum","--storage-local-rootdir","/charts","--storage","local"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
KSBUILDER_VERSION?=v0.3.11 | ||
ARCH?=amd64 | ||
IMAGE?=registry.cn-beijing.aliyuncs.com/kse/kse-extensions | ||
IMAGE_TAG?=latest | ||
|
||
|
||
help: | ||
@grep -hE '^[ a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \ | ||
awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-17s\033[0m %s\n", $$1, $$2}' | ||
|
||
.PHONY: generate-extensions-charts | ||
generate-extensions-charts: generate-kse-extensions generate-kse-extensions-publish ## Generate charts template for kse-extensions and kse-extensions-publish | ||
|
||
.PHONY: generate-kse-extensions | ||
generate-kse-extensions: ksbuilder ## Generate kse-extensions charts code | ||
.deploy/hack/upgrade-kse-extensions.sh | ||
|
||
|
||
.PHONY: generate-kse-extensions-publish | ||
generate-kse-extensions-publish: ksbuilder ## Generate kse-extensions-publish charts code | ||
.deploy/hack/upgrade-kse-extensions-publish.sh | ||
|
||
.PHONY: ksbuilder | ||
ksbuilder: ## install ksbuilder in "bin/" | ||
if [ ! -d bin ]; then \ | ||
mkdir bin; \ | ||
fi | ||
if [ ! -f bin/ksbuilder ]; then \ | ||
curl -L -O https://github.com/kubesphere/ksbuilder/releases/download/$(KSBUILDER_VERSION)/ksbuilder_$(patsubst v%,%,$(KSBUILDER_VERSION))_linux_$(ARCH).tar.gz; \ | ||
tar -zxvf ksbuilder_$(patsubst v%,%,$(KSBUILDER_VERSION))_linux_$(ARCH).tar.gz -C bin/ ksbuilder; \ | ||
rm -f ksbuilder_$(patsubst v%,%,$(KSBUILDER_VERSION))_linux_$(ARCH).tar.gz; \ | ||
fi | ||
|
||
.PHONY: package-all-charts | ||
package-all-charts: ksbuilder ## package all extensions to helm charts | ||
if [ ! -d bin/_output ]; then \ | ||
mkdir bin/_output; \ | ||
fi | ||
for chart in $$(find . -mindepth 1 -maxdepth 1 -type d); do \ | ||
if [ -f $${chart}/extension.yaml ] && grep -q "name" $${chart}/extension.yaml; then \ | ||
bin/ksbuilder package $${chart}; \ | ||
mv $${chart}-*.tgz bin/_output; \ | ||
fi \ | ||
done |