Skip to content

Commit

Permalink
dist: Add debian packaging (envoyproxy#17979)
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Northey <ryan@synca.io>

Signed-off-by: Andre Vehreschild <vehre@x41-dsec.de>
  • Loading branch information
phlax authored and vehre-x41 committed Apr 19, 2022
1 parent f0ceff0 commit 042f0f7
Show file tree
Hide file tree
Showing 2 changed files with 103 additions and 2 deletions.
68 changes: 68 additions & 0 deletions .azure-pipelines/pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,74 @@ stages:
artifactSuffix: ".arm64"
bazelBuildExtraOptions: "--sandbox_base=/tmp/sandbox_base"

- stage: distribution
dependsOn: ["linux_arm64", "linux_x64"]
jobs:
- job: package_x64
dependsOn: []
timeoutInMinutes: 120
pool:
vmImage: "ubuntu-18.04"
steps:
- template: bazel.yml
parameters:
ciTarget: bazel.distribution
- job: package_arm64
dependsOn: []
timeoutInMinutes: 120
pool: "arm-large"
steps:
- template: bazel.yml
parameters:
managedAgent: false
ciTarget: bazel.distribution
rbe: false
artifactSuffix: ".arm64"
bazelBuildExtraOptions: "--sandbox_base=/tmp/sandbox_base"
- job: verify_x64
dependsOn: ["package_x64"]
timeoutInMinutes: 120
pool:
vmImage: "ubuntu-18.04"
steps:
- task: DownloadBuildArtifacts@0
inputs:
buildType: current
artifactName: "bazel.distribution"
itemPattern: "bazel.distribution/packages.x64.tar.gz"
downloadType: single
targetPath: $(Build.StagingDirectory)
- script: ci/run_envoy_docker.sh 'ci/do_ci.sh verify_distro'
workingDirectory: $(Build.SourcesDirectory)
env:
AZP_BRANCH: $(Build.SourceBranch)
ENVOY_DOCKER_BUILD_DIR: $(Build.StagingDirectory)
BAZEL_REMOTE_CACHE: grpcs://remotebuildexecution.googleapis.com
BAZEL_REMOTE_INSTANCE: projects/envoy-ci/instances/default_instance
GCP_SERVICE_ACCOUNT_KEY: $(GcpServiceAccountKey)
displayName: "Verify packages"
- job: verify_arm64
dependsOn: ["package_arm64"]
timeoutInMinutes: 120
pool: "arm-large"
steps:
- task: DownloadBuildArtifacts@0
inputs:
buildType: current
artifactName: "bazel.distribution.arm64"
itemPattern: "bazel.distribution.arm64/packages.arm64.tar.gz"
downloadType: single
targetPath: $(Build.StagingDirectory)
- script: ci/run_envoy_docker.sh 'ci/do_ci.sh verify_distro'
workingDirectory: $(Build.SourcesDirectory)
env:
AZP_BRANCH: $(Build.SourceBranch)
ENVOY_DOCKER_BUILD_DIR: $(Build.StagingDirectory)
BAZEL_REMOTE_CACHE: grpcs://remotebuildexecution.googleapis.com
BAZEL_REMOTE_INSTANCE: projects/envoy-ci/instances/default_instance
GCP_SERVICE_ACCOUNT_KEY: $(GcpServiceAccountKey)
displayName: "Verify packages"

- stage: check
dependsOn: ["linux_x64"]
jobs:
Expand Down
37 changes: 35 additions & 2 deletions ci/do_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -227,6 +228,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-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
Expand Down Expand Up @@ -508,6 +533,14 @@ elif [[ "$CI_TARGET" == "tooling" ]]; then
elif [[ "$CI_TARGET" == "verify_examples" ]]; then
run_ci_verify "*" "wasm-cc|win32-front-proxy|shared"
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
Expand Down

0 comments on commit 042f0f7

Please sign in to comment.