-
Notifications
You must be signed in to change notification settings - Fork 45
Run e2e tests on each PR. #584
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
base: main
Are you sure you want to change the base?
Conversation
f302bd5
to
6889e0f
Compare
6ab7639
to
33568a6
Compare
33568a6
to
abfb1b6
Compare
49efd46
to
252675f
Compare
6eeab24
to
91edc88
Compare
91edc88
to
7255a2b
Compare
|
||
publish-layer-{{ $environment_name }} ({{ $runtime.name }}-{{ $runtime.arch }}): | ||
stage: publish | ||
tags: ["arch:amd64"] | ||
image: registry.ddbuild.io/images/docker:20.10-py3 | ||
rules: | ||
- if: '"{{ $environment_name }}" == "sandbox" && $REGION == "{{ $e2e_region }}" && "{{ $runtime.arch }}" == "amd64"' | ||
when: on_success |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Always be sure to publish to the sandbox account in us-west-2 for e2e testing.
- if: '"{{ $environment_name }}" == "sandbox"' | ||
when: manual | ||
allow_failure: true | ||
- if: '$CI_COMMIT_TAG =~ /^v.*/' | ||
artifacts: | ||
reports: | ||
dotenv: {{ $dotenv }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When saved as a dotenv report, this file will get sourced for its env vars in every downstream job.
{{- range (ds "runtimes").runtimes }} | ||
{{- if eq .arch "amd64" }} | ||
{{- $version := print (.name | strings.Trim "python") }} | ||
PYTHON_{{ $version }}_VERSION: $PYTHON_{{ $version }}_VERSION |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Explicitly pass environment variables from the sourced publish job dotenv file to the downstream job. These env vars are not passed downstream otherwise.
{{- end }} | ||
needs: {{ range (ds "runtimes").runtimes }} | ||
{{- if eq .arch "amd64" }} | ||
- "publish-layer-sandbox ({{ .name }}-{{ .arch }}): [{{ $e2e_region }}]" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Run after all the publish jobs have completed.
{{- end }} | ||
{{- end }} | ||
|
||
e2e-status: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The purpose of this job is to simply relay the status of the downstream job back to the github pull request. Without this, the downstream e2e tests still run, and the e2e-test
job will still properly fail. However, none of those failures would be posted to github, because gitlab will only post direct jobs, not jobs that it's triggering in another repo.
- e2e-test | ||
{{- range (ds "runtimes").runtimes }} | ||
{{- if eq .arch "amd64" }} | ||
- "publish-layer-sandbox ({{ .name }}-{{ .arch }}): [{{ $e2e_region }}]" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to need these in order to get the PYTHON_x_VERSION
env vars.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On second thought, I don't actually think these are required. But I've left them in anyway just in case.
image: registry.ddbuild.io/images/mirror/alpine:latest | ||
tags: ["arch:amd64"] | ||
needs: | ||
- e2e-test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This job will run once the e2e-test
job completes.
@@ -199,6 +199,8 @@ fi | |||
while [ $latest_version -lt $VERSION ]; do | |||
latest_version=$(publish_layer $REGION $layer $aws_cli_python_version_key $layer_path) | |||
printf "[$REGION] Published version $latest_version for layer $layer in region $REGION\n" | |||
latest_arn=$(aws lambda get-layer-version --layer-name $layer --version-number $latest_version --region $REGION --query 'LayerVersionArn' --output text) | |||
printf "[$REGION] Published arn $latest_arn\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Be sur to always print the arn to stdout when publishing layers. The publish gitlab jobs will do a regex search on this stdout to determine the arn for a newly published layer.
1b774ac
to
dfdc510
Compare
4ce0906
to
20a2b56
Compare
cf6e21c
to
75357ef
Compare
bfe7f03
to
57056ba
Compare
What does this PR do?
Run the serverless-e2e-tests on PR, skipping anything that isn't a python test. First publishes the layer build to sandbox account region us-west-2. Then, after gathering the arn for the new layer, pass that to the e2e tests for testing.
Motivation
Better to get alerted right away to potential e2e bugs.
Testing Guidelines
Additional Notes
Because this job is triggering job in a different repo, it is quite tough to access the results of that downstream job. As designed right now, a
e2e-status
job will be created in addition to thee2e-test
job. This status job runs only after thee2e-test
job completes. The reason this status job is necessary is so that we can post the results back to github.The problem with this is the
e2e-status
job can take hours to fully complete. That's because not only do all the other tests in this repo need to run (integration, unit, layer size, etc), it also needs to run the e2e tests, and it must also wait for the full teardown of aws resources. The latter is what can take so long because these teardown jobs are set to run after a 2 hour delay. So, we technically aren't able to get results posted back to github until all of that completes.The work around, which was too hard to implement with the time I had, is to use the gitlab api to poll the status of the
e2e-test
job. This might involve creating a Project Token which is more work that I think it's worth.An alternative solution is to set the
e2e-status
test as required by github. There are some major problems with this though. There are times in which we would expect that the e2e tests would fail. For example, if I'm implementing a new feature which will turn an e2e test from not working to working, then the e2e tests themselves will always fail in that case, which is what we want. To get around that, we could remove the xfail strict requirement on the e2e tests downstream. But this would mean we aren't able to keep our feature parity doc in lock step with reality.At this point, I think the best thing to do is to mark the
e2e-status
job as required. We are always able to override these failures in the UI, which shouldn't mean we're moving any slower.Types of Changes
Check all that apply
https://datadoghq.atlassian.net/browse/APMSVLS-20