Refine Azure Pipelines & Bazel: remove unnecessary steps (#246)

* Bazel: remove GPG sign
* Azure Pipelines: remove unnecessary steps
pull/2757/head
Loyalsoldier 4 years ago committed by GitHub
parent 2fc5f96a1d
commit dcf368bd93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -21,49 +21,22 @@ steps:
- task: GoTool@0 - task: GoTool@0
inputs: inputs:
version: '1.15.2' version: '1.15.2'
- script: |
mkdir triggersrc
ls -I "triggersrc" | xargs cp -rf -t triggersrc
mkdir gopath
displayName: Prepare Environment
workingDirectory: '$(system.defaultWorkingDirectory)'
- script: |
sudo apt-get -y update
sudo apt-get -y install jq git file pkg-config zip g++ zlib1g-dev unzip python openssl tree
displayName: Apt Install
- script: | - script: |
go version go version
unset GOPATH mkdir -p $GOPATH/src/v2ray.com
mkdir ./src ln -s $(pwd) $GOPATH/src/v2ray.com/core
mkdir ./src/v2ray.com ls -lah $GOPATH/src/v2ray.com/core
ln -s $(pwd)/../triggersrc ./src/v2ray.com/core cd $GOPATH/src/v2ray.com/core || exit 1
go get -v -t -d ./src/v2ray.com/core/... go mod download
tree workingDirectory: '$(system.defaultWorkingDirectory)'
workingDirectory: '$(GOPATH)'
displayName: 'Fetch sources' displayName: 'Fetch sources'
- script: | - script: |
mkdir release cd ./src/v2ray.com/core || exit 1
cd src bazel build --action_env=GOPATH=$GOPATH --action_env=PATH=$PATH --action_env=SPWD=$PWD --action_env=GOCACHE=$(go env GOCACHE) --spawn_strategy local //release:all
zip -9 -r ../release/src_all.zip * -x '*.git*'
workingDirectory: '$(GOPATH)'
displayName: 'Dump sources'
- script: |
curl -L -o bazel-installer.sh https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VER}/bazel-${BAZEL_VER}-installer-linux-x86_64.sh
chmod +x bazel-installer.sh
./bazel-installer.sh --user
workingDirectory: '$(GOPATH)'
displayName: 'Install Bazel'
- script: |
cd ./src/v2ray.com/core
$HOME/bin/bazel build --action_env=GOPATH=$GOPATH --action_env=PATH=$PATH --action_env=GPG_PASS=${SIGN_KEY_PASS} --action_env=SPWD=$PWD --action_env=GOCACHE=$(go env GOCACHE) --spawn_strategy local //release:all
workingDirectory: '$(GOPATH)' workingDirectory: '$(GOPATH)'
displayName: 'Build Binaries' displayName: 'Build Binaries'
- script: | - script: |
cp ./src/v2ray.com/core/bazel-bin/release/*.zip ./release/ cd ./src/v2ray.com/core || exit 1
workingDirectory: '$(GOPATH)'
displayName: 'Dump Binaries'
- script: |
cd ./src/v2ray.com/core
echo $RELEASE_TAG echo $RELEASE_TAG
./release/bleedingrelease.sh ./release/bleedingrelease.sh
workingDirectory: '$(GOPATH)' workingDirectory: '$(GOPATH)'
@ -77,7 +50,7 @@ steps:
GITHUB_REPO_OWNER: v2fly GITHUB_REPO_OWNER: v2fly
GITHUB_REPO_NAME: v2ray-core GITHUB_REPO_NAME: v2ray-core
- script: | - script: |
cd ./src/v2ray.com/core cd ./src/v2ray.com/core || exit 1
echo $RELEASE_TAG echo $RELEASE_TAG
./release/tagrelease.sh ./release/tagrelease.sh
workingDirectory: '$(GOPATH)' workingDirectory: '$(GOPATH)'

@ -1,23 +0,0 @@
def _gpg_sign_impl(ctx):
output_file = ctx.actions.declare_file(ctx.file.base.basename + ctx.attr.suffix, sibling = ctx.file.base)
if not ctx.configuration.default_shell_env.get("GPG_PASS"):
ctx.actions.write(output_file, "")
else:
command = "echo ${GPG_PASS} | gpg --pinentry-mode loopback --digest-algo SHA512 --passphrase-fd 0 --output %s --detach-sig %s" % (output_file.path, ctx.file.base.path)
ctx.actions.run_shell(
command = command,
use_default_shell_env = True,
inputs = [ctx.file.base],
outputs = [output_file],
progress_message = "Signing binary",
mnemonic = "gpg",
)
return [DefaultInfo(files = depset([output_file]))]
gpg_sign = rule(
implementation = _gpg_sign_impl,
attrs = {
"base": attr.label(allow_single_file=True),
"suffix": attr.string(default=".sig"),
},
)

@ -1,5 +1,4 @@
load("//infra/bazel:build.bzl", "foreign_go_binary") load("//infra/bazel:build.bzl", "foreign_go_binary")
load("//infra/bazel:gpg.bzl", "gpg_sign")
def gen_targets(matrix): def gen_targets(matrix):
pkg = "v2ray.com/core/infra/control/main" pkg = "v2ray.com/core/infra/control/main"
@ -20,11 +19,6 @@ def gen_targets(matrix):
gotags = "confonly", gotags = "confonly",
) )
gpg_sign(
name = bin_name + "_sig",
base = ":" + bin_name,
)
else: else:
bin_name = "v2ctl_" + os + "_" + arch bin_name = "v2ctl_" + os + "_" + arch
foreign_go_binary( foreign_go_binary(
@ -37,11 +31,6 @@ def gen_targets(matrix):
gotags = "confonly", gotags = "confonly",
) )
gpg_sign(
name = bin_name + "_sig",
base = ":" + bin_name,
)
if arch in ["mips", "mipsle"]: if arch in ["mips", "mipsle"]:
bin_name = "v2ctl_" + os + "_" + arch + "_softfloat" bin_name = "v2ctl_" + os + "_" + arch + "_softfloat"
foreign_go_binary( foreign_go_binary(
@ -54,8 +43,3 @@ def gen_targets(matrix):
mips = "softfloat", mips = "softfloat",
gotags = "confonly", gotags = "confonly",
) )
gpg_sign(
name = bin_name + "_sig",
base = ":" + bin_name,
)

@ -1,5 +1,4 @@
load("//infra/bazel:build.bzl", "foreign_go_binary") load("//infra/bazel:build.bzl", "foreign_go_binary")
load("//infra/bazel:gpg.bzl", "gpg_sign")
def gen_targets(matrix): def gen_targets(matrix):
pkg = "v2ray.com/core/main" pkg = "v2ray.com/core/main"
@ -19,11 +18,6 @@ def gen_targets(matrix):
arm = ver, arm = ver,
) )
gpg_sign(
name = bin_name + "_sig",
base = ":" + bin_name,
)
if os in ["windows"]: if os in ["windows"]:
bin_name = "v2ray_" + os + "_" + arch + "_" + ver + "_nowindow" bin_name = "v2ray_" + os + "_" + arch + "_" + ver + "_nowindow"
foreign_go_binary( foreign_go_binary(
@ -37,11 +31,6 @@ def gen_targets(matrix):
ld = "-H windowsgui", ld = "-H windowsgui",
) )
gpg_sign(
name = bin_name + "_sig",
base = ":" + bin_name,
)
else: else:
bin_name = "v2ray_" + os + "_" + arch bin_name = "v2ray_" + os + "_" + arch
foreign_go_binary( foreign_go_binary(
@ -53,11 +42,6 @@ def gen_targets(matrix):
ver = ver, ver = ver,
) )
gpg_sign(
name = bin_name + "_sig",
base = ":" + bin_name,
)
if os in ["windows"]: if os in ["windows"]:
bin_name = "v2ray_" + os + "_" + arch + "_nowindow" bin_name = "v2ray_" + os + "_" + arch + "_nowindow"
foreign_go_binary( foreign_go_binary(
@ -70,11 +54,6 @@ def gen_targets(matrix):
ld = "-H windowsgui", ld = "-H windowsgui",
) )
gpg_sign(
name = bin_name + "_sig",
base = ":" + bin_name,
)
if arch in ["mips", "mipsle"]: if arch in ["mips", "mipsle"]:
bin_name = "v2ray_" + os + "_" + arch + "_softfloat" bin_name = "v2ray_" + os + "_" + arch + "_softfloat"
foreign_go_binary( foreign_go_binary(
@ -86,8 +65,3 @@ def gen_targets(matrix):
ver = ver, ver = ver,
mips = "softfloat", mips = "softfloat",
) )
gpg_sign(
name = bin_name + "_sig",
base = ":" + bin_name,
)

@ -40,9 +40,7 @@ pkg_zip(
":doc", ":doc",
":geodata", ":geodata",
"//infra/control/main:v2ctl_darwin_amd64", "//infra/control/main:v2ctl_darwin_amd64",
"//infra/control/main:v2ctl_darwin_amd64_sig",
"//main:v2ray_darwin_amd64", "//main:v2ray_darwin_amd64",
"//main:v2ray_darwin_amd64_sig",
], ],
out = "v2ray-macos-64.zip", out = "v2ray-macos-64.zip",
mappings = gen_mappings("darwin", "amd64", "0"), mappings = gen_mappings("darwin", "amd64", "0"),
@ -55,11 +53,8 @@ pkg_zip(
":doc", ":doc",
":geodata", ":geodata",
"//infra/control/main:v2ctl_windows_amd64", "//infra/control/main:v2ctl_windows_amd64",
"//infra/control/main:v2ctl_windows_amd64_sig",
"//main:v2ray_windows_amd64", "//main:v2ray_windows_amd64",
"//main:v2ray_windows_amd64_sig",
"//main:v2ray_windows_amd64_nowindow", "//main:v2ray_windows_amd64_nowindow",
"//main:v2ray_windows_amd64_nowindow_sig",
], ],
out = "v2ray-windows-64.zip", out = "v2ray-windows-64.zip",
mappings = gen_mappings("windows", "amd64", "0"), mappings = gen_mappings("windows", "amd64", "0"),
@ -72,11 +67,8 @@ pkg_zip(
":doc", ":doc",
":geodata", ":geodata",
"//infra/control/main:v2ctl_windows_386", "//infra/control/main:v2ctl_windows_386",
"//infra/control/main:v2ctl_windows_386_sig",
"//main:v2ray_windows_386", "//main:v2ray_windows_386",
"//main:v2ray_windows_386_sig",
"//main:v2ray_windows_386_nowindow", "//main:v2ray_windows_386_nowindow",
"//main:v2ray_windows_386_nowindow_sig",
], ],
out = "v2ray-windows-32.zip", out = "v2ray-windows-32.zip",
mappings = gen_mappings("windows", "386", "0"), mappings = gen_mappings("windows", "386", "0"),
@ -89,11 +81,8 @@ pkg_zip(
":doc", ":doc",
":geodata", ":geodata",
"//infra/control/main:v2ctl_windows_arm_7", "//infra/control/main:v2ctl_windows_arm_7",
"//infra/control/main:v2ctl_windows_arm_7_sig",
"//main:v2ray_windows_arm_7", "//main:v2ray_windows_arm_7",
"//main:v2ray_windows_arm_7_sig",
"//main:v2ray_windows_arm_7_nowindow", "//main:v2ray_windows_arm_7_nowindow",
"//main:v2ray_windows_arm_7_nowindow_sig",
], ],
out = "v2ray-windows-arm32-v7a.zip", out = "v2ray-windows-arm32-v7a.zip",
mappings = gen_mappings("windows", "arm", "7"), mappings = gen_mappings("windows", "arm", "7"),
@ -106,9 +95,7 @@ pkg_zip(
":doc", ":doc",
":geodata", ":geodata",
"//infra/control/main:v2ctl_freebsd_amd64", "//infra/control/main:v2ctl_freebsd_amd64",
"//infra/control/main:v2ctl_freebsd_amd64_sig",
"//main:v2ray_freebsd_amd64", "//main:v2ray_freebsd_amd64",
"//main:v2ray_freebsd_amd64_sig",
], ],
out = "v2ray-freebsd-64.zip", out = "v2ray-freebsd-64.zip",
mappings = gen_mappings("freebsd", "amd64", "0"), mappings = gen_mappings("freebsd", "amd64", "0"),
@ -121,9 +108,7 @@ pkg_zip(
":doc", ":doc",
":geodata", ":geodata",
"//infra/control/main:v2ctl_freebsd_386", "//infra/control/main:v2ctl_freebsd_386",
"//infra/control/main:v2ctl_freebsd_386_sig",
"//main:v2ray_freebsd_386", "//main:v2ray_freebsd_386",
"//main:v2ray_freebsd_386_sig",
], ],
out = "v2ray-freebsd-32.zip", out = "v2ray-freebsd-32.zip",
mappings = gen_mappings("freebsd", "386", "0"), mappings = gen_mappings("freebsd", "386", "0"),
@ -136,9 +121,7 @@ pkg_zip(
":doc", ":doc",
":geodata", ":geodata",
"//infra/control/main:v2ctl_openbsd_amd64", "//infra/control/main:v2ctl_openbsd_amd64",
"//infra/control/main:v2ctl_openbsd_amd64_sig",
"//main:v2ray_openbsd_amd64", "//main:v2ray_openbsd_amd64",
"//main:v2ray_openbsd_amd64_sig",
], ],
out = "v2ray-openbsd-64.zip", out = "v2ray-openbsd-64.zip",
mappings = gen_mappings("openbsd", "amd64", "0"), mappings = gen_mappings("openbsd", "amd64", "0"),
@ -151,9 +134,7 @@ pkg_zip(
":doc", ":doc",
":geodata", ":geodata",
"//infra/control/main:v2ctl_openbsd_386", "//infra/control/main:v2ctl_openbsd_386",
"//infra/control/main:v2ctl_openbsd_386_sig",
"//main:v2ray_openbsd_386", "//main:v2ray_openbsd_386",
"//main:v2ray_openbsd_386_sig",
], ],
out = "v2ray-openbsd-32.zip", out = "v2ray-openbsd-32.zip",
mappings = gen_mappings("openbsd", "386", "0"), mappings = gen_mappings("openbsd", "386", "0"),
@ -166,9 +147,7 @@ pkg_zip(
":doc", ":doc",
":geodata", ":geodata",
"//infra/control/main:v2ctl_dragonfly_amd64", "//infra/control/main:v2ctl_dragonfly_amd64",
"//infra/control/main:v2ctl_dragonfly_amd64_sig",
"//main:v2ray_dragonfly_amd64", "//main:v2ray_dragonfly_amd64",
"//main:v2ray_dragonfly_amd64_sig",
], ],
out = "v2ray-dragonfly-64.zip", out = "v2ray-dragonfly-64.zip",
mappings = gen_mappings("dragonfly", "amd64", "0"), mappings = gen_mappings("dragonfly", "amd64", "0"),
@ -182,9 +161,7 @@ pkg_zip(
":geodata", ":geodata",
":systemd", ":systemd",
"//infra/control/main:v2ctl_linux_amd64", "//infra/control/main:v2ctl_linux_amd64",
"//infra/control/main:v2ctl_linux_amd64_sig",
"//main:v2ray_linux_amd64", "//main:v2ray_linux_amd64",
"//main:v2ray_linux_amd64_sig",
], ],
out = "v2ray-linux-64.zip", out = "v2ray-linux-64.zip",
mappings = gen_mappings("linux", "amd64", "0"), mappings = gen_mappings("linux", "amd64", "0"),
@ -198,9 +175,7 @@ pkg_zip(
":geodata", ":geodata",
":systemd", ":systemd",
"//infra/control/main:v2ctl_linux_386", "//infra/control/main:v2ctl_linux_386",
"//infra/control/main:v2ctl_linux_386_sig",
"//main:v2ray_linux_386", "//main:v2ray_linux_386",
"//main:v2ray_linux_386_sig",
], ],
out = "v2ray-linux-32.zip", out = "v2ray-linux-32.zip",
mappings = gen_mappings("linux", "386", "0"), mappings = gen_mappings("linux", "386", "0"),
@ -214,9 +189,7 @@ pkg_zip(
":geodata", ":geodata",
":systemd", ":systemd",
"//infra/control/main:v2ctl_linux_arm64", "//infra/control/main:v2ctl_linux_arm64",
"//infra/control/main:v2ctl_linux_arm64_sig",
"//main:v2ray_linux_arm64", "//main:v2ray_linux_arm64",
"//main:v2ray_linux_arm64_sig",
], ],
out = "v2ray-linux-arm64-v8a.zip", out = "v2ray-linux-arm64-v8a.zip",
mappings = gen_mappings("linux", "arm64", "0"), mappings = gen_mappings("linux", "arm64", "0"),
@ -230,9 +203,7 @@ pkg_zip(
":geodata", ":geodata",
":systemd", ":systemd",
"//infra/control/main:v2ctl_linux_arm_7", "//infra/control/main:v2ctl_linux_arm_7",
"//infra/control/main:v2ctl_linux_arm_7_sig",
"//main:v2ray_linux_arm_7", "//main:v2ray_linux_arm_7",
"//main:v2ray_linux_arm_7_sig",
], ],
out = "v2ray-linux-arm32-v7a.zip", out = "v2ray-linux-arm32-v7a.zip",
mappings = gen_mappings("linux", "arm", "7"), mappings = gen_mappings("linux", "arm", "7"),
@ -246,9 +217,7 @@ pkg_zip(
":geodata", ":geodata",
":systemd", ":systemd",
"//infra/control/main:v2ctl_linux_arm_6", "//infra/control/main:v2ctl_linux_arm_6",
"//infra/control/main:v2ctl_linux_arm_6_sig",
"//main:v2ray_linux_arm_6", "//main:v2ray_linux_arm_6",
"//main:v2ray_linux_arm_6_sig",
], ],
out = "v2ray-linux-arm32-v6.zip", out = "v2ray-linux-arm32-v6.zip",
mappings = gen_mappings("linux", "arm", "6"), mappings = gen_mappings("linux", "arm", "6"),
@ -262,9 +231,7 @@ pkg_zip(
":geodata", ":geodata",
":systemd", ":systemd",
"//infra/control/main:v2ctl_linux_arm_5", "//infra/control/main:v2ctl_linux_arm_5",
"//infra/control/main:v2ctl_linux_arm_5_sig",
"//main:v2ray_linux_arm_5", "//main:v2ray_linux_arm_5",
"//main:v2ray_linux_arm_5_sig",
], ],
out = "v2ray-linux-arm32-v5.zip", out = "v2ray-linux-arm32-v5.zip",
mappings = gen_mappings("linux", "arm", "5"), mappings = gen_mappings("linux", "arm", "5"),
@ -278,13 +245,9 @@ pkg_zip(
":geodata", ":geodata",
":systemd", ":systemd",
"//infra/control/main:v2ctl_linux_mips", "//infra/control/main:v2ctl_linux_mips",
"//infra/control/main:v2ctl_linux_mips_sig",
"//infra/control/main:v2ctl_linux_mips_softfloat", "//infra/control/main:v2ctl_linux_mips_softfloat",
"//infra/control/main:v2ctl_linux_mips_softfloat_sig",
"//main:v2ray_linux_mips", "//main:v2ray_linux_mips",
"//main:v2ray_linux_mips_sig",
"//main:v2ray_linux_mips_softfloat", "//main:v2ray_linux_mips_softfloat",
"//main:v2ray_linux_mips_softfloat_sig",
], ],
out = "v2ray-linux-mips32.zip", out = "v2ray-linux-mips32.zip",
mappings = gen_mappings("linux", "mips", "0"), mappings = gen_mappings("linux", "mips", "0"),
@ -298,13 +261,9 @@ pkg_zip(
":geodata", ":geodata",
":systemd", ":systemd",
"//infra/control/main:v2ctl_linux_mipsle", "//infra/control/main:v2ctl_linux_mipsle",
"//infra/control/main:v2ctl_linux_mipsle_sig",
"//infra/control/main:v2ctl_linux_mipsle_softfloat", "//infra/control/main:v2ctl_linux_mipsle_softfloat",
"//infra/control/main:v2ctl_linux_mipsle_softfloat_sig",
"//main:v2ray_linux_mipsle", "//main:v2ray_linux_mipsle",
"//main:v2ray_linux_mipsle_sig",
"//main:v2ray_linux_mipsle_softfloat", "//main:v2ray_linux_mipsle_softfloat",
"//main:v2ray_linux_mipsle_softfloat_sig",
], ],
out = "v2ray-linux-mips32le.zip", out = "v2ray-linux-mips32le.zip",
mappings = gen_mappings("linux", "mipsle", "0"), mappings = gen_mappings("linux", "mipsle", "0"),
@ -318,9 +277,7 @@ pkg_zip(
":geodata", ":geodata",
":systemd", ":systemd",
"//infra/control/main:v2ctl_linux_mips64", "//infra/control/main:v2ctl_linux_mips64",
"//infra/control/main:v2ctl_linux_mips64_sig",
"//main:v2ray_linux_mips64", "//main:v2ray_linux_mips64",
"//main:v2ray_linux_mips64_sig",
], ],
out = "v2ray-linux-mips64.zip", out = "v2ray-linux-mips64.zip",
mappings = gen_mappings("linux", "mips64", "0"), mappings = gen_mappings("linux", "mips64", "0"),
@ -334,9 +291,7 @@ pkg_zip(
":geodata", ":geodata",
":systemd", ":systemd",
"//infra/control/main:v2ctl_linux_mips64le", "//infra/control/main:v2ctl_linux_mips64le",
"//infra/control/main:v2ctl_linux_mips64le_sig",
"//main:v2ray_linux_mips64le", "//main:v2ray_linux_mips64le",
"//main:v2ray_linux_mips64le_sig",
], ],
out = "v2ray-linux-mips64le.zip", out = "v2ray-linux-mips64le.zip",
mappings = gen_mappings("linux", "mips64le", "0"), mappings = gen_mappings("linux", "mips64le", "0"),
@ -350,9 +305,7 @@ pkg_zip(
":geodata", ":geodata",
":systemd", ":systemd",
"//infra/control/main:v2ctl_linux_riscv64", "//infra/control/main:v2ctl_linux_riscv64",
"//infra/control/main:v2ctl_linux_riscv64_sig",
"//main:v2ray_linux_riscv64", "//main:v2ray_linux_riscv64",
"//main:v2ray_linux_riscv64_sig",
], ],
out = "v2ray-linux-riscv64.zip", out = "v2ray-linux-riscv64.zip",
mappings = gen_mappings("linux", "riscv64", "0"), mappings = gen_mappings("linux", "riscv64", "0"),
@ -366,9 +319,7 @@ pkg_zip(
":geodata", ":geodata",
":systemd", ":systemd",
"//infra/control/main:v2ctl_linux_s390x", "//infra/control/main:v2ctl_linux_s390x",
"//infra/control/main:v2ctl_linux_s390x_sig",
"//main:v2ray_linux_s390x", "//main:v2ray_linux_s390x",
"//main:v2ray_linux_s390x_sig",
], ],
out = "v2ray-linux-s390x.zip", out = "v2ray-linux-s390x.zip",
mappings = gen_mappings("linux", "s390x", "0"), mappings = gen_mappings("linux", "s390x", "0"),
@ -382,9 +333,7 @@ pkg_zip(
":geodata", ":geodata",
":systemd", ":systemd",
"//infra/control/main:v2ctl_linux_ppc64", "//infra/control/main:v2ctl_linux_ppc64",
"//infra/control/main:v2ctl_linux_ppc64_sig",
"//main:v2ray_linux_ppc64", "//main:v2ray_linux_ppc64",
"//main:v2ray_linux_ppc64_sig",
], ],
out = "v2ray-linux-ppc64.zip", out = "v2ray-linux-ppc64.zip",
mappings = gen_mappings("linux", "ppc64", "0"), mappings = gen_mappings("linux", "ppc64", "0"),
@ -398,9 +347,7 @@ pkg_zip(
":geodata", ":geodata",
":systemd", ":systemd",
"//infra/control/main:v2ctl_linux_ppc64le", "//infra/control/main:v2ctl_linux_ppc64le",
"//infra/control/main:v2ctl_linux_ppc64le_sig",
"//main:v2ray_linux_ppc64le", "//main:v2ray_linux_ppc64le",
"//main:v2ray_linux_ppc64le_sig",
], ],
out = "v2ray-linux-ppc64le.zip", out = "v2ray-linux-ppc64le.zip",
mappings = gen_mappings("linux", "ppc64le", "0"), mappings = gen_mappings("linux", "ppc64le", "0"),

Loading…
Cancel
Save