Skip to content

Commit

Permalink
Merge pull request #65 from LinuxSuRen/fix/master-build
Browse files Browse the repository at this point in the history
Fix the action build base on the master branch
  • Loading branch information
LinuxSuRen authored Dec 14, 2021
2 parents 8947d85 + 572e3cf commit aa24288
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 71 deletions.
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/[email protected]
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

0 comments on commit aa24288

Please sign in to comment.