Browse Source

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

* Bazel: remove GPG sign
* Azure Pipelines: remove unnecessary steps
Loyalsoldier 5 years ago
parent
commit
dcf368bd93
5 changed files with 10 additions and 155 deletions
  1. 10 37
      azure-pipelines.yml
  2. 0 23
      infra/bazel/gpg.bzl
  3. 0 16
      infra/control/main/targets.bzl
  4. 0 26
      main/targets.bzl
  5. 0 53
      release/BUILD

+ 10 - 37
azure-pipelines.yml

@@ -22,48 +22,21 @@ steps:
     inputs:
       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: |
       go version
-      unset GOPATH
-      mkdir ./src
-      mkdir ./src/v2ray.com
-      ln -s $(pwd)/../triggersrc ./src/v2ray.com/core
-      go get -v -t -d ./src/v2ray.com/core/...
-      tree
-    workingDirectory: '$(GOPATH)'
+      mkdir -p $GOPATH/src/v2ray.com
+      ln -s $(pwd) $GOPATH/src/v2ray.com/core
+      ls -lah $GOPATH/src/v2ray.com/core
+      cd $GOPATH/src/v2ray.com/core || exit 1
+      go mod download
+    workingDirectory: '$(system.defaultWorkingDirectory)'
     displayName: 'Fetch sources'
   - script: |
-      mkdir release
-      cd src
-      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
+      cd ./src/v2ray.com/core || exit 1
+      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
     workingDirectory: '$(GOPATH)'
     displayName: 'Build Binaries'
   - script: |
-      cp ./src/v2ray.com/core/bazel-bin/release/*.zip ./release/
-    workingDirectory: '$(GOPATH)'
-    displayName: 'Dump Binaries'
-  - script: |
-      cd ./src/v2ray.com/core
+      cd ./src/v2ray.com/core || exit 1
       echo $RELEASE_TAG
       ./release/bleedingrelease.sh
     workingDirectory: '$(GOPATH)'
@@ -77,7 +50,7 @@ steps:
       GITHUB_REPO_OWNER: v2fly
       GITHUB_REPO_NAME: v2ray-core
   - script: |
-      cd ./src/v2ray.com/core
+      cd ./src/v2ray.com/core || exit 1
       echo $RELEASE_TAG
       ./release/tagrelease.sh
     workingDirectory: '$(GOPATH)'

+ 0 - 23
infra/bazel/gpg.bzl

@@ -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"),
-  },
-)

+ 0 - 16
infra/control/main/targets.bzl

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

+ 0 - 26
main/targets.bzl

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

+ 0 - 53
release/BUILD

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