-
Notifications
You must be signed in to change notification settings - Fork 5.5k
dist: Add debian packaging #17979
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
dist: Add debian packaging #17979
Changes from 11 commits
ddcb2b9
0ac11cc
869db6e
1c51ab5
0f915b7
679a074
f004eea
e20aa25
3108413
a67c40c
12a4876
789beb3
6b6c3e9
8b003b2
83a8cda
2fe92a9
5540ac1
05feaaf
433a263
118cf92
d6592d7
53768cf
0d7a91c
611209a
776f941
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,8 +7,9 @@ set -e | |
|
|
||
| build_setup_args="" | ||
| if [[ "$1" == "format_pre" || "$1" == "fix_format" || "$1" == "check_format" || "$1" == "docs" || \ | ||
| "$1" == "bazel.clang_tidy" || "$1" == "tooling" || "$1" == "deps" || "$1" == "verify_examples" || \ | ||
| "$1" == "verify_build_examples" ]]; then | ||
| "$1" == "bazel.clang_tidy" || "$1" == "bazel.distribution" || "$1" == "tooling" \ | ||
| || "$1" == "deps" || "$1" == "verify_examples" || "$1" == "verify_build_examples" \ | ||
| || "$1" == "verify_distro" ]]; then | ||
| build_setup_args="-nofetch" | ||
| fi | ||
|
|
||
|
|
@@ -214,6 +215,30 @@ if [[ "$CI_TARGET" == "bazel.release" ]]; then | |
| echo "bazel contrib release build..." | ||
| bazel_contrib_binary_build release | ||
|
|
||
| exit 0 | ||
| elif [[ "$CI_TARGET" == "bazel.distribution" ]]; then | ||
| echo "Building distro packages..." | ||
|
|
||
| setup_clang_toolchain | ||
|
|
||
| # By default the packages will be signed by the first available key. | ||
| # If there is no key available, a throwaway key is created | ||
| # and the packages signed with it, for the purpose of testing only. | ||
| if ! gpg --list-secret-keys "*"; then | ||
| export PACKAGES_MAINTAINER_NAME="Envoy CI" | ||
| export PACKAGES_MAINTAINER_EMAIL="envoy@snake.oil" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it real mail? I do not see it in the doc.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it is not - and is intended to denote that - perhaps this could be more explicit in some way
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use envoy@packaging.example.com perhaps?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. updated to envoy-ci@for.testing.only |
||
| BAZEL_BUILD_OPTIONS+=( | ||
| "--action_env=PACKAGES_GEN_KEY=1" | ||
| "--action_env=PACKAGES_MAINTAINER_NAME" | ||
| "--action_env=PACKAGES_MAINTAINER_EMAIL") | ||
| fi | ||
|
|
||
| bazel build "${BAZEL_BUILD_OPTIONS[@]}" -c opt //distribution:packages.tar.gz | ||
| if [[ "${ENVOY_BUILD_ARCH}" == "x86_64" ]]; then | ||
| cp -a bazel-bin/distribution/packages.tar.gz "${ENVOY_BUILD_DIR}/packages.x64.tar.gz" | ||
| else | ||
| cp -a bazel-bin/distribution/packages.tar.gz "${ENVOY_BUILD_DIR}/packages.arm64.tar.gz" | ||
| fi | ||
| exit 0 | ||
| elif [[ "$CI_TARGET" == "bazel.release.server_only" ]]; then | ||
| setup_clang_toolchain | ||
|
|
@@ -485,6 +510,14 @@ elif [[ "$CI_TARGET" == "tooling" ]]; then | |
| elif [[ "$CI_TARGET" == "verify_examples" ]]; then | ||
| run_ci_verify "*" "wasm-cc|win32-front-proxy" | ||
| exit 0 | ||
| elif [[ "$CI_TARGET" == "verify_distro" ]]; then | ||
| if [[ "${ENVOY_BUILD_ARCH}" == "x86_64" ]]; then | ||
| PACKAGE_BUILD=/build/bazel.distribution/packages.x64.tar.gz | ||
| else | ||
| PACKAGE_BUILD=/build/bazel.distribution.arm64/packages.arm64.tar.gz | ||
| fi | ||
| bazel run "${BAZEL_BUILD_OPTIONS[@]}" //distribution:verify_packages "$PACKAGE_BUILD" | ||
| exit 0 | ||
| elif [[ "$CI_TARGET" == "verify_build_examples" ]]; then | ||
| run_ci_verify wasm-cc | ||
| exit 0 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| load("//bazel:envoy_build_system.bzl", "envoy_package") | ||
| load(":packages.bzl", "envoy_pkg_distros") | ||
| load("@envoy_repo//:version.bzl", "VERSION") | ||
|
|
||
| licenses(["notice"]) # Apache 2 | ||
|
|
||
| envoy_package() | ||
|
|
||
| MAINTAINER = "Envoy maintainers <envoy-maintainers@googlegroups.com>" | ||
|
|
||
| genrule( | ||
| name = "envoy-bin", | ||
| srcs = ["//source/exe:envoy-static.stripped"], | ||
| outs = ["envoy"], | ||
| cmd = "cp -L $< $@", | ||
| ) | ||
|
|
||
| envoy_pkg_distros( | ||
| name = "packages", | ||
| maintainer = MAINTAINER, | ||
| version = VERSION, | ||
| ) | ||
|
|
||
| genrule( | ||
| name = "verification", | ||
| outs = ["verification.sh"], | ||
| cmd = """ | ||
| echo 'exec $${@}' > $@ \ | ||
| && chmod +x $@ | ||
| """, | ||
| ) | ||
|
|
||
| sh_binary( | ||
| name = "verify_packages", | ||
|
phlax marked this conversation as resolved.
|
||
| srcs = [":verification.sh"], | ||
| args = [ | ||
| "$(location //tools/distribution:verify)", | ||
| "$(location :distrotest.sh)", | ||
| VERSION, | ||
| "$(location :distros.yaml)", | ||
| ], | ||
| data = [ | ||
| ":distros.yaml", | ||
| ":distrotest.sh", | ||
| "//tools/distribution:verify", | ||
| ], | ||
| ) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| load("//bazel:envoy_build_system.bzl", "envoy_package") | ||
|
|
||
| licenses(["notice"]) # Apache 2 | ||
|
|
||
| envoy_package() | ||
|
|
||
| exports_files([ | ||
| "copyright", | ||
| "preinst", | ||
| "postinst", | ||
| ]) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ | ||
| Upstream-Name: Envoy | ||
| Source: <https://github.com/envoyproxy/envoy> | ||
|
|
||
| Files: * | ||
| Copyright: Copyright 2016-2018 Envoy Project Authors | ||
| License: Apache | ||
| /usr/share/common-licenses/Apache-2.0 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| load("@rules_pkg//pkg:pkg.bzl", "pkg_tar") | ||
| load("@rules_pkg//pkg:deb.bzl", "pkg_deb") | ||
|
|
||
| GLIBC_MIN_VERSION = "2.27" | ||
|
|
||
| def envoy_pkg_deb( | ||
| name, | ||
| data, | ||
| homepage = "https://www.envoyproxy.io/", | ||
| description = "Envoy built for Debian/Ubuntu", | ||
| preinst = "//distribution/debian:preinst", | ||
| postinst = "//distribution/debian:postinst", | ||
| supported_distributions = "buster bullseye bionic focal hirstute impish", | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add a note about ensuring these match
phlax marked this conversation as resolved.
Outdated
|
||
| architecture = select({ | ||
| "//bazel:x86": "amd64", | ||
| "//conditions:default": "arm64", | ||
| }), | ||
| depends = [ | ||
| "libc6 (>= %s)" % GLIBC_MIN_VERSION, | ||
| ], | ||
| version = None, | ||
| maintainer = None, | ||
| **kwargs): | ||
| """Wrapper for `pkg_deb` with Envoy defaults""" | ||
| pkg_deb( | ||
| name = "%s-deb" % name, | ||
| architecture = architecture, | ||
| data = data, | ||
| depends = depends, | ||
| description = description, | ||
| distribution = supported_distributions, | ||
| homepage = homepage, | ||
| maintainer = maintainer, | ||
| package = name, | ||
| version = version, | ||
| preinst = preinst, | ||
| postinst = postinst, | ||
| **kwargs | ||
| ) | ||
|
|
||
| native.filegroup( | ||
| name = "%s.changes" % name, | ||
| srcs = ["%s-deb" % name], | ||
| output_group = "changes", | ||
| ) | ||
| native.filegroup( | ||
| name = "%s.deb" % name, | ||
| srcs = ["%s-deb" % name], | ||
| output_group = "deb", | ||
| ) | ||
|
|
||
| def envoy_pkg_debs(name, version, release_version, maintainer, bin_files = ":envoy-bin-files", config = ":envoy-config"): | ||
| """Package the Envoy .debs with their .changes files. | ||
|
|
||
| Packages are created for the version *and* the release version, eg | ||
|
|
||
| - envoy_1.21.0_amd64.deb | ||
| - envoy-1.21_1.21.0_amd64.deb | ||
|
|
||
| This way packages are available for both "envoy" and "envoy-1.21" in package managers. | ||
| """ | ||
|
|
||
| # generate deb data for all packages | ||
| pkg_tar( | ||
| name = "deb-data", | ||
| srcs = [ | ||
| "//distribution/debian:copyright", | ||
| config, | ||
| bin_files, | ||
| ], | ||
| remap_paths = {"/copyright": "/usr/share/doc/envoy/copyright"}, | ||
| ) | ||
|
|
||
| # generate package for this patch version | ||
| envoy_pkg_deb( | ||
| name = "envoy", | ||
| data = ":deb-data", | ||
| version = version, | ||
| maintainer = maintainer, | ||
| ) | ||
|
|
||
| # generate package for this minor version | ||
| envoy_pkg_deb( | ||
| name = "envoy-%s" % release_version, | ||
| data = ":deb-data", | ||
| version = version, | ||
| conflicts = ["envoy"], | ||
| provides = ["envoy"], | ||
| maintainer = maintainer, | ||
| ) | ||
|
|
||
| pkg_tar( | ||
| name = name, | ||
| srcs = [ | ||
| "envoy.changes", | ||
| "envoy.deb", | ||
| "envoy-%s.changes" % release_version, | ||
| "envoy-%s.deb" % release_version, | ||
| ], | ||
| extension = "tar", | ||
| package_dir = "deb", | ||
| ) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| #!/bin/sh | ||
|
|
||
| # postinst script for envoy | ||
|
|
||
| set -e | ||
|
|
||
| case "$1" in | ||
|
|
||
| configure) | ||
| cat <<BANNER | ||
|
|
||
| You have installed the Envoy proxy server. | ||
|
|
||
| You can check your Envoy version by running the following in a terminal: | ||
|
|
||
| $ envoy --version | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add info about running as envoy user |
||
|
|
||
| Documentation for your version is available at: | ||
|
|
||
| https://www.envoyproxy.io/docs | ||
|
|
||
| The Envoy project can be found at: | ||
|
|
||
| https://github.com/envoyproxy/envoy | ||
|
|
||
| BANNER | ||
| ;; | ||
|
|
||
| abort-upgrade|abort-remove|abort-deconfigure) | ||
| exit 0 | ||
| ;; | ||
|
|
||
| *) | ||
| echo "postinst called with unknown argument \`$1'" >&2 | ||
| exit 1 | ||
| ;; | ||
|
|
||
| esac | ||
|
|
||
| #DEBHELPER# | ||
|
|
||
| exit 0 | ||
Uh oh!
There was an error while loading. Please reload this page.