Skip to content

Commit

Permalink
feat(autok3s): compress linux amd64/arm64/arm binaries
Browse files Browse the repository at this point in the history
Signed-off-by: Jason-ZW <zhenyang@rancher.com>
  • Loading branch information
rancher-sy-bot committed Sep 25, 2020
1 parent c2716bd commit 7525c0f
Show file tree
Hide file tree
Showing 2 changed files with 195 additions and 34 deletions.
228 changes: 194 additions & 34 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ depends_on:
- lint
---
kind: pipeline
name: build
name: compress-amd64
platform:
os: linux
arch: amd64
Expand All @@ -79,50 +79,158 @@ steps:
volumes:
- name: docker
path: /var/run/docker.sock
- name: github_binary_release
- name: compress
image: maiwj/drone-dapper:v0.4.2
privileged: true
environment:
BY: dapper
commands:
- wget https://github.com/upx/upx/releases/download/v3.96/upx-3.96-amd64_linux.tar.xz
- tar -xvf upx-3.96-amd64_linux.tar.xz
- cp upx-3.96-amd64_linux/upx /usr/bin/
- upx --brute dist/autok3s_linux_amd64
volumes:
- name: docker
path: /var/run/docker.sock
when:
event:
- tag
depends_on:
- build
- name: github_linux_amd64_binary_release
image: ibuildthecloud/github-release:v0.0.1
settings:
api_key:
from_secret: github_token
prerelease: true
checksum:
- sha256
checksum_file: CHECKSUMsum.txt
checksum_file: CHECKSUMsum-amd64.txt
checksum_flatten: true
files:
- "dist/autok3s_*"
- "dist/autok3s_linux_amd64"
when:
event:
- tag
depends_on:
- build
- name: package
- compress
- name: github_darwin_amd64_binary_release
image: ibuildthecloud/github-release:v0.0.1
settings:
api_key:
from_secret: github_token
prerelease: true
checksum:
- sha256
checksum_file: CHECKSUMsum-darwin-amd64.txt
checksum_flatten: true
files:
- "dist/autok3s_darwin_amd64"
when:
event:
- tag
depends_on:
- compress
- name: github_windows_amd64_binary_release
image: ibuildthecloud/github-release:v0.0.1
settings:
api_key:
from_secret: github_token
prerelease: true
checksum:
- sha256
checksum_file: CHECKSUMsum-windows-amd64.txt
checksum_flatten: true
files:
- "dist/autok3s_windows_amd64.exe"
when:
event:
- tag
depends_on:
- compress
- name: github_windows_386_binary_release
image: ibuildthecloud/github-release:v0.0.1
settings:
api_key:
from_secret: github_token
prerelease: true
checksum:
- sha256
checksum_file: CHECKSUMsum-windows-386.txt
checksum_flatten: true
files:
- "dist/autok3s_windows_386.exe"
when:
event:
- tag
depends_on:
- compress
volumes:
- name: docker
host:
path: /var/run/docker.sock
trigger:
event:
include:
- push
- pull_request
- tag
node:
instance: agent-amd64
depends_on:
- integration-test
---
kind: pipeline
name: compress-arm64
platform:
os: linux
arch: arm64
steps:
- name: build
image: maiwj/drone-dapper:v0.4.2
privileged: true
environment:
BY: dapper
DOCKER_USERNAME:
from_secret: docker_username
DOCKER_PASSWORD:
from_secret: docker_password
REPO: cnrancher
WITHOUT_MANIFEST: true
commands:
- make autok3s package only
- make autok3s deploy only
- make autok3s build only
volumes:
- name: docker
path: /var/run/docker.sock
- name: compress
image: maiwj/drone-dapper:v0.4.2
privileged: true
environment:
BY: dapper
commands:
- wget https://github.com/upx/upx/releases/download/v3.96/upx-3.96-arm64_linux.tar.xz
- tar -xvf upx-3.96-arm64_linux.tar.xz
- cp upx-3.96-arm64_linux/upx /usr/bin/
- upx --brute dist/autok3s_linux_arm64
volumes:
- name: docker
path: /var/run/docker.sock
when:
ref:
include:
- "refs/heads/master"
- "refs/heads/release/v*"
- "refs/tags/v*"
event:
exculde:
- pull_request
- tag
depends_on:
- build
- name: github_binary_release
image: ibuildthecloud/github-release:v0.0.1
settings:
api_key:
from_secret: github_token
prerelease: true
checksum:
- sha256
checksum_file: CHECKSUMsum-arm64.txt
checksum_flatten: true
files:
- "dist/autok3s_linux_arm64"
when:
event:
- tag
depends_on:
- compress
volumes:
- name: docker
host:
Expand All @@ -134,32 +242,82 @@ trigger:
- pull_request
- tag
node:
instance: agent-amd64
instance: agent-arm64
depends_on:
- integration-test
---
kind: pipeline
name: manifest
name: compress-arm
platform:
os: linux
arch: amd64
arch: arm
steps:
- name: push
- name: build
image: maiwj/drone-dapper:v0.4.2
privileged: true
environment:
BY: dapper
DOCKER_USERNAME:
from_secret: docker_username
DOCKER_PASSWORD:
from_secret: docker_password
REPO: cnrancher
ONLY_MANIFEST: true
CROSS: true
commands:
- make autok3s deploy only
- make autok3s build only
volumes:
- name: docker
path: /var/run/docker.sock
- name: compress
image: maiwj/drone-dapper:v0.4.2
privileged: true
environment:
BY: dapper
commands:
- wget https://github.com/upx/upx/releases/download/v3.96/upx-3.96-arm_linux.tar.xz
- tar -xvf upx-3.96-arm_linux.tar.xz
- cp upx-3.96-arm_linux/upx /usr/bin/
- upx --brute dist/autok3s_linux_arm
volumes:
- name: docker
path: /var/run/docker.sock
when:
event:
- tag
depends_on:
- build
- name: github_binary_release
image: ibuildthecloud/github-release:v0.0.1
settings:
api_key:
from_secret: github_token
prerelease: true
checksum:
- sha256
checksum_file: CHECKSUMsum-arm.txt
checksum_flatten: true
files:
- "dist/autok3s_linux_arm"
when:
event:
- tag
depends_on:
- compress
volumes:
- name: docker
host:
path: /var/run/docker.sock
trigger:
event:
include:
- push
- pull_request
- tag
node:
instance: agent-arm
depends_on:
- integration-test
---
kind: pipeline
name: manifest
platform:
os: linux
arch: amd64
steps:
- name: release-note
image: maiwj/drone-releaser:v0.1.0
commands:
Expand Down Expand Up @@ -201,4 +359,6 @@ trigger:
node:
instance: agent-amd64
depends_on:
- build
- compress-amd64
- compress-arm64
- compress-arm
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ Use `Makefile` to manage project compilation, testing and packaging.
Of course, you can also choose to compile using `dapper`.
Install `dapper` please follow the [dapper](https://github.com/rancher/dapper) project. PRs are welcome.

- vendor: `GO111MODULE=on go mod vendor`
- compilation: `BY=dapper make autok3s`
- testing: `BY=dapper make autok3s unit`
- packing: `BY=dapper make autok3s package only`
Expand Down

0 comments on commit 7525c0f

Please # to comment.