Skip to content
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

ci: use azp for api and go-control-plane sync #13550

Merged
merged 3 commits into from
Oct 14, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .azure-pipelines/pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ jobs:
- job: filter_example
displayName: "filter-example sync"
dependsOn: []
pool:
vmImage: "ubuntu-18.04"
condition: and(succeeded(), eq(variables['PostSubmit'], true))
steps:
- task: InstallSSHKey@0
Expand All @@ -133,6 +135,50 @@ jobs:
env:
AZP_BRANCH: $(Build.SourceBranch)

- job: api
displayName: "data-plane-api sync"
dependsOn: []
condition: and(succeeded(), eq(variables['PostSubmit'], true))
pool:
vmImage: "ubuntu-18.04"
steps:
- task: InstallSSHKey@0
inputs:
hostName: "github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ=="
sshPublicKey: "$(DataPlaneApiPublicKey)"
sshPassphrase: "$(SshDeployKeyPassphrase)"
sshKeySecureFile: "$(DataPlaneApiPrivateKey)"

- bash: ci/api_mirror.sh
lizan marked this conversation as resolved.
Show resolved Hide resolved
displayName: "Sync data-plane-api"
workingDirectory: $(Build.SourcesDirectory)
env:
AZP_BRANCH: $(Build.SourceBranch)

- job: go_control_plane
displayName: "go-control-plane sync"
dependsOn: []
condition: and(succeeded(), eq(variables['PostSubmit'], true))
steps:
- task: InstallSSHKey@0
inputs:
hostName: "github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ=="
sshPublicKey: "$(GoControlPlanePublicKey)"
sshPassphrase: "$(SshDeployKeyPassphrase)"
sshKeySecureFile: "$(GoControlPlanePrivateKey)"

- bash: |
cp -a ~/.ssh $(Build.StagingDirectory)/
ci/run_envoy_docker.sh 'ci/go_mirror.sh'
displayName: "Sync go-control-plane"
workingDirectory: $(Build.SourcesDirectory)
env:
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)
AZP_BRANCH: $(Build.SourceBranch)

- job: bazel
displayName: "Linux-x64"
dependsOn: ["release"]
Expand All @@ -141,6 +187,8 @@ jobs:
strategy:
maxParallel: 3
matrix:
api:
CI_TARGET: "bazel.api"
lizan marked this conversation as resolved.
Show resolved Hide resolved
gcc:
CI_TARGET: "bazel.gcc"
clang_tidy:
Expand Down
43 changes: 0 additions & 43 deletions .circleci/config.yml

This file was deleted.

13 changes: 6 additions & 7 deletions ci/api_mirror.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@
set -e

CHECKOUT_DIR=../data-plane-api
MAIN_BRANCH="refs/heads/master"
API_MAIN_BRANCH="master"

if [ -z "$CIRCLE_PULL_REQUEST" ] && [ "$CIRCLE_BRANCH" == "master" ]
then
if [[ "${AZP_BRANCH}" == "${MAIN_BRANCH}" ]]; then
echo "Cloning..."
git clone git@github.com:envoyproxy/data-plane-api "$CHECKOUT_DIR"
git clone git@github.com:envoyproxy/data-plane-api "$CHECKOUT_DIR" -b "${API_MAIN_BRANCH}"

git -C "$CHECKOUT_DIR" config user.name "data-plane-api(CircleCI)"
git -C "$CHECKOUT_DIR" config user.name "data-plane-api(Azure Pipelines)"
git -C "$CHECKOUT_DIR" config user.email data-plane-api@users.noreply.github.com
git -C "$CHECKOUT_DIR" fetch
git -C "$CHECKOUT_DIR" checkout -B master origin/master

# Determine last envoyproxy/envoy SHA in envoyproxy/data-plane-api
MIRROR_MSG="Mirrored from https://github.com/envoyproxy/envoy"
Expand Down Expand Up @@ -40,6 +39,6 @@ then
done

echo "Pushing..."
git -C "$CHECKOUT_DIR" push origin master
git -C "$CHECKOUT_DIR" push origin "${API_MAIN_BRANCH}"
echo "Done"
fi
13 changes: 7 additions & 6 deletions ci/do_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -312,19 +312,20 @@ elif [[ "$CI_TARGET" == "bazel.compile_time_options" ]]; then
collect_build_profile build
exit 0
elif [[ "$CI_TARGET" == "bazel.api" ]]; then
# Use libstdc++ because the API booster isn't capable of working with libc++ yet.
ENVOY_STDLIB="libstdc++"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is the part that is confusing me. Can you add more comments here per the other comments? Is this because of RBE or something else? Why doesn't it work and why do we need to set this? Otherwise LGTM.

/wait

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

setup_clang_toolchain
export LLVM_CONFIG="${LLVM_ROOT}"/bin/llvm-config
echo "Validating API structure..."
./tools/api/validate_structure.py
echo "Testing API and API Boosting..."
bazel_with_collection test "${BAZEL_BUILD_OPTIONS[@]}" -c fastbuild @envoy_api_canonical//test/... @envoy_api_canonical//tools/... \
@envoy_api_canonical//tools:tap2pcap_test @envoy_dev//clang_tools/api_booster/...
echo "Building API..."
bazel build "${BAZEL_BUILD_OPTIONS[@]}" -c fastbuild @envoy_api_canonical//envoy/...
echo "Testing API..."
bazel_with_collection test "${BAZEL_BUILD_OPTIONS[@]}" -c fastbuild @envoy_api_canonical//test/... @envoy_api_canonical//tools/... \
@envoy_api_canonical//tools:tap2pcap_test
echo "Testing API boosting (unit tests)..."
bazel_with_collection test "${BAZEL_BUILD_OPTIONS[@]}" -c fastbuild @envoy_dev//clang_tools/api_booster/...
echo "Testing API boosting (golden C++ tests)..."
# We use custom BAZEL_BUILD_OPTIONS here; the API booster isn't capable of working with libc++ yet.
LLVM_CONFIG="${LLVM_ROOT}"/bin/llvm-config BAZEL_BUILD_OPTIONS="--config=clang" python3.8 ./tools/api_boost/api_boost_test.py
BAZEL_BUILD_OPTIONS="${BAZEL_BUILD_OPTIONS[*]}" python3.8 ./tools/api_boost/api_boost_test.py
exit 0
elif [[ "$CI_TARGET" == "bazel.coverage" || "$CI_TARGET" == "bazel.fuzz_coverage" ]]; then
setup_clang_toolchain
Expand Down
10 changes: 7 additions & 3 deletions ci/go_mirror.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

set -e

if [ -z "$CIRCLE_PULL_REQUEST" ] && [ "$CIRCLE_BRANCH" == "master" ]
then
tools/api/generate_go_protobuf.py
MAIN_BRANCH="refs/heads/master"

# shellcheck source=ci/setup_cache.sh
. "$(dirname "$0")"/setup_cache.sh

if [[ "${AZP_BRANCH}" == "${MAIN_BRANCH}" ]]; then
BAZEL_BUILD_OPTIONS="${BAZEL_BUILD_EXTRA_OPTIONS}" tools/api/generate_go_protobuf.py
fi
1 change: 1 addition & 0 deletions ci/run_envoy_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ mkdir -p "${ENVOY_DOCKER_BUILD_DIR}"

[[ -t 1 ]] && ENVOY_DOCKER_OPTIONS+=("-it")
[[ -f .git ]] && [[ ! -d .git ]] && ENVOY_DOCKER_OPTIONS+=(-v "$(git rev-parse --git-common-dir):$(git rev-parse --git-common-dir)")
[[ -n "${SSH_AUTH_SOCK}" ]] && ENVOY_DOCKER_OPTIONS+=(-v "${SSH_AUTH_SOCK}:${SSH_AUTH_SOCK}" -e SSH_AUTH_SOCK)

export ENVOY_BUILD_IMAGE="${IMAGE_NAME}:${IMAGE_ID}"

Expand Down
12 changes: 7 additions & 5 deletions tools/api/generate_go_protobuf.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,21 @@
from subprocess import check_call
import glob
import os
import shlex
import shutil
import sys
import re

# Needed for CI to pass down bazel options.
BAZEL_BUILD_OPTIONS = shlex.split(os.environ.get('BAZEL_BUILD_OPTIONS', ''))

TARGETS = '@envoy_api//...'
IMPORT_BASE = 'github.com/envoyproxy/go-control-plane'
OUTPUT_BASE = 'build_go'
REPO_BASE = 'go-control-plane'
BRANCH = 'master'
MIRROR_MSG = 'Mirrored from envoyproxy/envoy @ '
USER_NAME = 'go-control-plane(CircleCI)'
USER_NAME = 'go-control-plane(Azure Pipelines)'
USER_EMAIL = 'go-control-plane@users.noreply.github.com'


Expand All @@ -32,7 +36,7 @@ def generateProtobufs(output):
check_call([
'bazel', 'build', '-c', 'fastbuild',
'--experimental_proto_descriptor_sets_include_source_info'
] + go_protos)
] + BAZEL_BUILD_OPTIONS + go_protos)

for rule in go_protos:
# Example rule:
Expand Down Expand Up @@ -67,9 +71,7 @@ def git(repo, *args):

def cloneGoProtobufs(repo):
# Create a local clone of go-control-plane
git(None, 'clone', 'git@github.com:envoyproxy/go-control-plane', repo)
git(repo, 'fetch')
git(repo, 'checkout', '-B', BRANCH, 'origin/master')
git(None, 'clone', 'git@github.com:envoyproxy/go-control-plane', repo, '-b', BRANCH)


def findLastSyncSHA(repo):
Expand Down
1 change: 0 additions & 1 deletion tools/api_boost/api_boost.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ def ApiBoostTree(target_paths,
sp.run([
'bazel',
'build',
'--config=libc++',
lizan marked this conversation as resolved.
Show resolved Hide resolved
'--strip=always',
] + BAZEL_BUILD_OPTIONS + dep_lib_build_targets,
check=True)
Expand Down