Skip to content

Commit 677bc49

Browse files
committed
init
1 parent fdde5ad commit 677bc49

File tree

3 files changed

+67
-0
lines changed

3 files changed

+67
-0
lines changed

.evergreen/functions.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,27 @@ post:
132132
params:
133133
file: src/.logs/*.xml
134134
functions:
135+
build-e2e-docker-image:
136+
command: shell.exec
137+
type: setup
138+
params:
139+
shell: bash
140+
working_dir: mms
141+
include_expansions_in_env: [BAZELISK_HOME, AWS_SECRET_ACCESS_KEY, AWS_ACCESS_KEY_ID, AWS_SESSION_TOKEN]
142+
env:
143+
XDG_RUNTIME_DIR: ${workdir}/docker/run
144+
DOCKER_CONFIG: ${workdir}/mms/.docker/mms
145+
script: |
146+
set -exu
147+
export DOCKER_HOST="unix://$XDG_RUNTIME_DIR/docker.sock"
148+
PATH="${workdir}/bin:$PATH" bazel build ${bazel_args} ${bazel_target}
149+
150+
package-and-publish-e2e-docker-image:
151+
- *skip-if-patch-build
152+
- *build-e2e-docker-image
153+
- *check-if-e2e-docker-image-is-already-published
154+
- *publish-e2e-docker-image
155+
135156
clone:
136157
- command: git.get_project
137158
type: system
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# "bullseye" is the debian distribution that ubuntu:20.04 is based on
2+
ARG NODE_JS_VERSION=20
3+
FROM node:${NODE_JS_VERSION}-bullseye
4+
5+
COPY . /compass-monorepo-root
6+
WORKDIR /compass-monorepo-root
7+
8+
RUN npm i -g [email protected]
9+
RUN npm run bootstrap-ci
10+
11+
CMD ["npm run test-web"]
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env bash
2+
3+
post_evergreen_status() {
4+
status="$1"
5+
type="$2"
6+
desc="$3"
7+
should_continue="$4"
8+
curl --silent --show-error --header "Content-Type: application/json" --data \
9+
'{"status": "'"$status"'", "type": "'"$type"'", "desc": "'"$desc"'", "should_continue": '"$should_continue"'}' \
10+
"http://localhost:2285/task_status" || true
11+
}
12+
13+
# NOTE: do not -x here there are "env" vars in the commands
14+
set -e
15+
16+
MONOREPO_ROOT_DIR="$(cd $(dirname "$0")/../..; pwd)"
17+
cd $MONOREPO_ROOT_DIR
18+
19+
echo "building e2e tests image from ${PWD}"
20+
docker build -t compass-e2e-tests:$github_commit --build-arg "NODE_JS_VERSION=$NODE_JS_VERSION" -f "./.evergreen/package-and-publish-e2e-docker-image/Dockerfile" .
21+
echo "e2e tests image built"
22+
23+
# skip if the image already exists
24+
if aws ecr describe-images --region $ECR_REGION --repository-name=compass/e2e-tests --image-ids=imageTag=$github_commit; then
25+
echo "Image with tag '${github_commit}' found in the 'compass/e2e-tests' repository. Setting task status to 'success'..."
26+
post_evergreen_status success test "image tag '${github_commit}' already exists in the 'compass/e2e-tests' repository" false
27+
else
28+
echo "Image with tag '${github_commit}' not found in the 'compass/e2e-tests' repository. Continuing with remainder of task..."
29+
fi
30+
31+
echo "pushing e2e tests image to ECR"
32+
aws ecr get-login-password --region $ECR_REGION | docker login --username AWS --password-stdin $ECR_REGISTRY
33+
docker tag compass-e2e-tests:$github_commit $ECR_REGISTRY/compass/e2e-tests:$github_commit
34+
docker push $ECR_REGISTRY/compass/e2e-tests:$github_commit
35+
echo "image pushed"

0 commit comments

Comments
 (0)