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

Fix the action build base on the master branch #65

Merged
merged 1 commit into from
Dec 14, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
60 changes: 0 additions & 60 deletions .github/workflows/build-image.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
name: Build Dev Image
name: Build Image

on:
push:
branches:
- master
- "release-**"
tags:
- v**

jobs:
build:
Expand Down Expand Up @@ -33,20 +35,33 @@ jobs:
wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2
tar xvjf phantomjs-2.1.1-linux-x86_64.tar.bz2
ls -ahl

# v2.0-alpha-6 is a pre-release, jcli is not able to download it automatically.
mkdir -p ~/.jenkins-cli
curl https://github.com/LinuxSuRen/custom-war-packager/releases/download/v2.0-alpha-6/custom-war-packager-cli-2.0-alpha-7-20210527.031403-1-jar-with-dependencies.jar \
-L --output ~/.jenkins-cli/cwp-cli.jar
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build env
id: build_env
shell: bash
run: |
echo "::set-output name=version::${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}"
- name: Build
run: |
docker login --username ${{ secrets.DOCKER_HUB_USER }} --password ${{secrets.DOCKER_HUB_TOKEN}}

curl -L https://github.com/jenkins-zh/jenkins-cli/releases/latest/download/jcli-linux-amd64.tar.gz|tar xzv

export PATH=.:$PATH:phantomjs/bin

# there's no a release for the multi-arch building but https://github.com/jenkinsci/custom-war-packager/releases/tag/v2.0-alpha-6
wget https://github.com/LinuxSuRen/custom-war-packager/releases/download/v2.0-alpha-6/custom-war-packager-cli-2.0-alpha-7-20210527.031403-1-jar-with-dependencies.jar
mv custom-war-packager-cli-2.0-alpha-7-20210527.031403-1-jar-with-dependencies.jar ~/.jenkins-cli/cwp-cli.jar
jcli cwp --install-artifacts --config-path formula.yaml --value-set output=push \
--value-set version=kubespheredev/ks-jenkins:${{ steps.meta.outputs.version }}
--value-set tag=kubespheredev/ks-jenkins:${{ steps.build_env.outputs.version }} \
--value-set platform=linux/amd64,linux/arm64
- name: Push Image ghcr.io
run: |
docker login ghcr.io --username ${{ secrets.GH_USER }} --password ${{secrets.GH_TOKEN}}
jcli cwp --install-artifacts --config-path formula.yaml --value-set output=push \
--value-set tag=ghcr.io/kubesphere/ks-jenkins:${{ steps.meta.outputs.version }}
--value-set tag=ghcr.io/kubesphere/ks-jenkins:${{ steps.build_env.outputs.version }} \
--value-set platform=linux/amd64,linux/arm64
7 changes: 4 additions & 3 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,15 @@ jobs:
run: |
echo "::set-output name=version::${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}"
- name: Build
shell: bash
run: |
curl -L https://github.com/jenkins-zh/jenkins-cli/releases/latest/download/jcli-linux-amd64.tar.gz|tar xzv
export PATH=.:$PATH:phantomjs/bin
wget https://github.com/LinuxSuRen/custom-war-packager/releases/download/v2.0-alpha-6/custom-war-packager-cli-2.0-alpha-7-20210527.031403-1-jar-with-dependencies.jar
mv custom-war-packager-cli-2.0-alpha-7-20210527.031403-1-jar-with-dependencies.jar ~/.jenkins-cli/cwp-cli.jar

jcli cwp --install-artifacts --config-path formula.yaml \
--value-set output=load \
--value-set tag=kubespheredev/ks-jenkins:${{ steps.build_env.outputs.version }}
--value-set tag=kubespheredev/ks-jenkins:${{ steps.build_env.outputs.version }} \
--value-set platform=linux/amd64
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@0.2.0
if: github.event_name == 'pull_request'
Expand Down
3 changes: 2 additions & 1 deletion formula.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ buildSettings:
docker:
base: jenkins/jenkins:2.319.1
tag: {{.tag}}
platform: linux/amd64,linux/arm64
output: {{.output}}
platform: {{.platform}}
buildx: true
build: true
war:
Expand Down