Skip to content

Commit aafa858

Browse files
musaprgmathetake
andauthored
ci: Remove CI configurations for private repos and Fixes CI issues for macos (#112)
* fix e2e Signed-off-by: mathetake <[email protected]> * fix e2e Signed-off-by: mathetake <[email protected]> * Fix permission of install_docker.sh Signed-off-by: Kotaro Inoue <[email protected]> * Fix to suite current convention of brew cask in install_docker.sh Signed-off-by: Kotaro Inoue <[email protected]> * Fix brew cask command to the latest format Signed-off-by: Kotaro Inoue <[email protected]> * Revert "Fix brew cask command to the latest format" This reverts commit bfccf6e. Signed-off-by: Kotaro Inoue <[email protected]> * Fix a bit Signed-off-by: Kotaro Inoue <[email protected]> * Fix a bit Signed-off-by: Kotaro Inoue <[email protected]> * Fix to use local formulae downloaded from remote Signed-off-by: Kotaro Inoue <[email protected]> * Fix DEVELOPER.md Signed-off-by: Kotaro Inoue <[email protected]> Co-authored-by: mathetake <[email protected]>
1 parent ef34965 commit aafa858

File tree

6 files changed

+7
-141
lines changed

6 files changed

+7
-141
lines changed

.github/workflows/commit.yaml

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,6 @@ jobs:
5454
run: make builders
5555

5656
- name: "Run e2e tests using `getenvoy` and `e2e` binaries built by the upstream job"
57-
env:
58-
# Allow extension templates to have dependecies on private GitHub repositories.
59-
E2E_ALLOW_PRIVATE_DEPENDENCIES: 'yes'
60-
# Key of a GitHub "machine user" that has access to all private repositories needed by e2e tests:
61-
# user: https://github.com/getenvoy-ci
62-
# key fingeprint: MD5:ae:8d:18:6a:1b:44:17:dc:b8:c8:0f:a9:48:44:be:2b
63-
#
64-
# See https://developer.github.com/v3/guides/managing-deploy-keys/#machine-users
65-
E2E_GITHUB_MACHINE_USER_KEY: ${{ secrets.E2E_GITHUB_MACHINE_USER_KEY }}
6657
run: ./ci/e2e/linux/run_tests.sh
6758

6859
e2e_macos:
@@ -91,13 +82,4 @@ jobs:
9182
run: make builders
9283

9384
- name: "Run e2e tests using `getenvoy` and `e2e` binaries built by the upstream job"
94-
env:
95-
# Allow extension templates to have dependecies on private GitHub repositories.
96-
E2E_ALLOW_PRIVATE_DEPENDENCIES: 'yes'
97-
# Key of a GitHub "machine user" that has access to all private repositories needed by e2e tests:
98-
# user: https://github.com/getenvoy-ci
99-
# key fingeprint: MD5:ae:8d:18:6a:1b:44:17:dc:b8:c8:0f:a9:48:44:be:2b
100-
#
101-
# See https://developer.github.com/v3/guides/managing-deploy-keys/#machine-users
102-
E2E_GITHUB_MACHINE_USER_KEY: ${{ secrets.E2E_GITHUB_MACHINE_USER_KEY }}
10385
run: ./ci/e2e/macos/run_tests.sh

.github/workflows/release.yaml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,6 @@ jobs:
123123
# `getenvoy extension build | test | run` stable
124124

125125
- name: "Run e2e tests using released `getenvoy` binary and published extension builder images"
126-
env:
127-
# Forbid extension templates to have dependecies on private GitHub repositories.
128-
E2E_ALLOW_PRIVATE_DEPENDENCIES: 'no'
129126
run: ./ci/e2e/linux/run_tests.sh
130127

131128
e2e_macos:
@@ -169,7 +166,4 @@ jobs:
169166
# `getenvoy extension build | test | run` stable
170167

171168
- name: "Run e2e tests using released `getenvoy` binary and published extension builder images"
172-
env:
173-
# Forbid extension templates to have dependecies on private GitHub repositories.
174-
E2E_ALLOW_PRIVATE_DEPENDENCIES: 'no'
175169
run: ./ci/e2e/macos/run_tests.sh

DEVELOPER.md

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -42,62 +42,9 @@ getenvoy extension init my-extension
4242
```
4343
and follow the wizard.
4444

45-
> NOTE: At the moment, `Rust` extensions have a dependency on a private `GitHub` repository [tetratelabs/envoy-wasm-rust-sdk](https://github.com/tetratelabs/envoy-wasm-rust-sdk).
46-
>
47-
> In practice, it means that `Rust` toolchain (`cargo`) will have to pass through [GitHub authenticatation]() to be able to fetch the source code of [tetratelabs/envoy-wasm-rust-sdk](https://github.com/tetratelabs/envoy-wasm-rust-sdk).
48-
>
49-
> For more details see a section on [SSH authentication](https://doc.rust-lang.org/cargo/appendix/git-authentication.html#ssh-authentication) in the [Cargo Book](https://doc.rust-lang.org/cargo/).
50-
51-
To build a Wasm extension on `Mac OS`, do the following:
52-
1. [Configure SSH agent](https://help.github.com/en/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent#adding-your-ssh-key-to-the-ssh-agent)
53-
2. Run:
54-
```shell
55-
cd my-new-extension
56-
57-
getenvoy extension build --toolchain-container-options \
58-
'--mount type=bind,src=/run/host-services/ssh-auth.sock,target=/run/host-services/ssh-auth.sock -e SSH_AUTH_SOCK=/run/host-services/ssh-auth.sock'
59-
```
60-
6145
### How to run e2e Tests
6246

6347
Run:
6448
```shell
6549
make e2e
6650
```
67-
68-
> NOTE: At the moment, `Rust` extensions have a dependency on a private `GitHub` repository [tetratelabs/envoy-wasm-rust-sdk](https://github.com/tetratelabs/envoy-wasm-rust-sdk).
69-
>
70-
> In practice, it means that `Rust` toolchain (`cargo`) will have to pass through [GitHub authenticatation]() to be able to fetch the source code of [tetratelabs/envoy-wasm-rust-sdk](https://github.com/tetratelabs/envoy-wasm-rust-sdk).
71-
>
72-
> For more details see a section on [SSH authentication](https://doc.rust-lang.org/cargo/appendix/git-authentication.html#ssh-authentication) in the [Cargo Book](https://doc.rust-lang.org/cargo/).
73-
74-
To run e2e tests on `Mac OS`, do the following:
75-
1. [Configure SSH agent](https://help.github.com/en/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent#adding-your-ssh-key-to-the-ssh-agent)
76-
2. Run:
77-
```shell
78-
bash -c '
79-
set -e
80-
81-
#
82-
# restore original ownership over the SSH agent socket (mounted inside container)
83-
#
84-
trap "docker run --rm -t --mount type=bind,src=/run/host-services/ssh-auth.sock,target=/run/host-services/ssh-auth.sock busybox chown 0 /run/host-services/ssh-auth.sock" EXIT
85-
86-
#
87-
# pass ownership over the SSH agent socket (mounted inside container) to the current user
88-
#
89-
docker run --rm -t --mount type=bind,src=/run/host-services/ssh-auth.sock,target=/run/host-services/ssh-auth.sock busybox chown $(id -u) /run/host-services/ssh-auth.sock
90-
91-
#
92-
# Run e2e tests in the following context:
93-
# 1. Pass SSH agent socket (so that build containers could download private dependencies)
94-
# 2. Override location of Cargo cache (so that all extensions and their build containers could share the same cache)
95-
#
96-
E2E_BUILTIN_TOOLCHAIN_CONTAINER_OPTIONS=" \
97-
--mount type=bind,src=/run/host-services/ssh-auth.sock,target=/run/host-services/ssh-auth.sock \
98-
-e SSH_AUTH_SOCK=/run/host-services/ssh-auth.sock \
99-
-v /tmp/cache/getenvoy:/tmp/cache/getenvoy \
100-
-e CARGO_HOME=/tmp/cache/getenvoy/extension/rust-builder/cargo" \
101-
make e2e
102-
'
103-
```

ci/e2e/linux/run_tests.sh

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -29,28 +29,6 @@ sudo chown -R $(id -u):$(id -g) "${E2E_CACHE_DIR}"
2929
# to speed up `getenvoy extension build|test`, re-use a single cache across all extensions created by e2e tests
3030
export E2E_BUILTIN_TOOLCHAIN_CONTAINER_OPTIONS="${E2E_BUILTIN_TOOLCHAIN_CONTAINER_OPTIONS} -v ${E2E_CACHE_DIR}:/tmp/cache/getenvoy -e CARGO_HOME=/tmp/cache/getenvoy/extension/rust-builder/cargo"
3131

32-
forward_ssh_agent=false
33-
case "${E2E_ALLOW_PRIVATE_DEPENDENCIES}" in
34-
yes | on | true | 1) forward_ssh_agent=true ;;
35-
esac
36-
37-
if [[ "${forward_ssh_agent}" == "true" ]]; then
38-
# setup SSH key that will be used by build containers to fetch private dependencies
39-
mkdir -p $HOME/.ssh/
40-
echo "${E2E_GITHUB_MACHINE_USER_KEY}" | base64 -d > $HOME/.ssh/id_rsa_e2e_github_machine_user
41-
chmod 600 $HOME/.ssh/id_rsa_e2e_github_machine_user
42-
43-
# use a dedicated SSH agent to manage the keys needed by extension build containers
44-
eval $(ssh-agent -s)
45-
# always kill that SSH agent in the end
46-
trap "ssh-agent -k" EXIT
47-
# load a single key of a GitHub "machine user" that has access to all private repositories needed by e2e tests
48-
ssh-add $HOME/.ssh/id_rsa_e2e_github_machine_user
49-
50-
# forward SSH agent into extension build containers so that to they could fetch source code from private GitHub repositories
51-
export E2E_BUILTIN_TOOLCHAIN_CONTAINER_OPTIONS="${E2E_BUILTIN_TOOLCHAIN_CONTAINER_OPTIONS} -v ${SSH_AUTH_SOCK}:${SSH_AUTH_SOCK} -e SSH_AUTH_SOCK"
52-
fi
53-
5432
# restore executable bit that get lost by Github Actions during artifact upload/download
5533
chmod a+x ${WORKSPACE_DIR}/build/bin/linux/amd64/*
5634

ci/e2e/macos/install_docker.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,16 @@
1616

1717
set -e
1818

19+
TMP_DIR=$(mktemp -d)
20+
1921
# Docker for Mac 2.0.0.3-ce-mac81,31259 (the last version of 'Docker for Mac' that can be installed in CI environment)
2022
E2E_MACOS_DOCKER_CASK_VERSION="${E2E_MACOS_DOCKER_CASK_VERSION:-8ce4e89d10716666743b28c5a46cd54af59a9cc2}"
2123

2224
# install Docker for Mac
23-
brew cask install https://raw.githubusercontent.com/Homebrew/homebrew-cask/${E2E_MACOS_DOCKER_CASK_VERSION}/Casks/docker.rb
25+
pushd "${TMP_DIR}"
26+
curl -L https://raw.githubusercontent.com/Homebrew/homebrew-cask/${E2E_MACOS_DOCKER_CASK_VERSION}/Casks/docker.rb > docker.rb
27+
brew install --cask docker.rb
28+
popd
2429

2530
# follow instructions from:
2631
# https://github.com/microsoft/azure-pipelines-image-generation/issues/738#issuecomment-496211237

ci/e2e/macos/run_tests.sh

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -24,53 +24,13 @@ E2E_CACHE_DIR="${E2E_CACHE_DIR:-$HOME/cache/getenvoy}"
2424
# make sure the cache directory is first created on behalf of the current user
2525
mkdir -p "${E2E_CACHE_DIR}"
2626

27+
# TODO: support multiple language
2728
# to speed up `getenvoy extension build|test`, re-use a single cache across all extensions created by e2e tests
2829
export E2E_BUILTIN_TOOLCHAIN_CONTAINER_OPTIONS="${E2E_BUILTIN_TOOLCHAIN_CONTAINER_OPTIONS} -v ${E2E_CACHE_DIR}:/tmp/cache/getenvoy -e CARGO_HOME=/tmp/cache/getenvoy/extension/rust-builder/cargo"
2930

3031
# set HOME directory
3132
export E2E_BUILTIN_TOOLCHAIN_CONTAINER_OPTIONS="${E2E_BUILTIN_TOOLCHAIN_CONTAINER_OPTIONS} -e HOME=/tmp/getenvoy"
3233

33-
forward_ssh_agent=false
34-
case "${E2E_ALLOW_PRIVATE_DEPENDENCIES}" in
35-
yes | on | true | 1) forward_ssh_agent=true ;;
36-
esac
37-
38-
if [[ "${forward_ssh_agent}" == "true" ]]; then
39-
# unfortunately, older versions of 'Docker for Mac' (that can be installed in CI environment)
40-
# do not support SSH agent forwarding.
41-
# that is why we have to take care of it manually and work around the limitation that it's not
42-
# possible to mount a Unix socket from a Mac host into a container
43-
44-
# setup SSH key that will be used by build containers to fetch private dependencies
45-
mkdir -p $HOME/.ssh/
46-
echo "${E2E_GITHUB_MACHINE_USER_KEY}" | base64 -D > $HOME/.ssh/id_rsa_e2e_github_machine_user
47-
chmod 600 $HOME/.ssh/id_rsa_e2e_github_machine_user
48-
49-
# create a wrapper script around the original container entrypoint to setup SSH agent inside the container
50-
echo '#!/usr/bin/env bash
51-
set -e
52-
# use an SSH agent to manage the keys (works better than a plain SSH key in case of Cargo)
53-
eval $(ssh-agent -s)
54-
# always kill that SSH agent in the end
55-
trap "ssh-agent -k" EXIT
56-
# load a single key of a GitHub "machine user" that has access to all private repositories needed by e2e tests
57-
ssh-add $HOME/.ssh/id_rsa
58-
# sanity check
59-
ssh-add -l
60-
61-
# call the original entrypoint
62-
/usr/local/getenvoy/extension/builder/entrypoint.sh "$@"
63-
' > /tmp/entrypoint-wrapper.sh
64-
chmod a+x /tmp/entrypoint-wrapper.sh
65-
66-
# mount SSH key into extension build containers
67-
export E2E_BUILTIN_TOOLCHAIN_CONTAINER_OPTIONS="${E2E_BUILTIN_TOOLCHAIN_CONTAINER_OPTIONS} -v $HOME/.ssh/id_rsa_e2e_github_machine_user:/tmp/getenvoy/.ssh/id_rsa"
68-
# mount the entrypoint wrapper script
69-
export E2E_BUILTIN_TOOLCHAIN_CONTAINER_OPTIONS="${E2E_BUILTIN_TOOLCHAIN_CONTAINER_OPTIONS} -v /tmp/entrypoint-wrapper.sh:/tmp/getenvoy/entrypoint-wrapper.sh"
70-
# substitute entrypoint with a wrapper script
71-
export E2E_BUILTIN_TOOLCHAIN_CONTAINER_OPTIONS="${E2E_BUILTIN_TOOLCHAIN_CONTAINER_OPTIONS} --entrypoint /tmp/getenvoy/entrypoint-wrapper.sh"
72-
fi
73-
7434
# restore executable bit that get lost by Github Actions during artifact upload/download
7535
chmod a+x ${WORKSPACE_DIR}/build/bin/darwin/amd64/*
7636

0 commit comments

Comments
 (0)