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

[test] Ensure image builds preserve environment variables #5609

Closed
wants to merge 3 commits into from

Conversation

geropl
Copy link
Member

@geropl geropl commented Sep 8, 2021

Description

Currently blocked by: #5497

Related Issue(s)

Ensures #5597 does not happen again.

How to test

cd /workspace/gitpod/test/tests/workspace && go test -run TestImageBuildPreservesEnvVar ./...

Release Notes

NONE

DockerfilePath: ".gitpod.Dockerfile",
ContextPath: ".",
Source: &csapi.WorkspaceInitializer{
Spec: &csapi.WorkspaceInitializer_Git{
Copy link
Contributor

Choose a reason for hiding this comment

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

Relying on external, pre-existing fixtures is bound to break. I'd strongly vote for trying to keep these tests self-contained.

We have a content initializer which can download files from a URL. We could use GCP storage to upload the file, produce a pre-signed URL and use that to init the workspace content. Alternatively we should use GitHub API/git to set up the repo before we use it.

Copy link
Member Author

@geropl geropl Sep 14, 2021

Choose a reason for hiding this comment

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

We have a content initializer which can download files from a URL.

Had the same line of thought, but ended it with "file download is equivalent to git clone". The idea with uploading the content upfront is nice, but then we should use sth that is available to all Gitpod installations (abuse content-service?). Also, we kind of break abstractions because we make assumptions about the internal structure of a workspace backup.

Alternatively we could have a variant of the FileDownloadInitializer/a new DirecContentInitializer which allows to pass bytes of a .tar.gz directly into the initializer spec. This would be awesome for testing. WDYT? @csweichel

Copy link
Member Author

Choose a reason for hiding this comment

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

I added FilesInitializer to see how it turns out - and it makes testing much more wholesome. 🤗
No hard feelings about names or impl but I like the idea.

Continuing on this: To even more encapsulate theses tests from GitHub especially we could have an CreateWorkspace API that takes an already parsed context (for testing only?). Context parsing itself should be handled by unit tests, so we don't loose anything by taking it out of the loop. Plus we achieve "full GitHub independence". 🙂

Copy link
Member Author

Choose a reason for hiding this comment

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

o even more encapsulate theses tests from GitHub especially we could have an CreateWorkspace API that takes an already parsed context (for testing only?)

Thinking a bit more about it that does not make sense: We still rely on external services after context parsing (config deduction). Moving further down the chain calling WorkspaceStarter directly would be nice - and would eliminate the need for the "to-image-build-or-not" in the integration test suite. 😬

@roboquat
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To complete the pull request process, please assign csweichel after the PR has been reviewed.
You can assign the PR to them by writing /assign @csweichel in a comment when ready.

Associated issue: #5497

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@roboquat roboquat added size/XXL and removed size/L labels Sep 15, 2021
@stale
Copy link

stale bot commented Oct 1, 2021

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the meta: stale This issue/PR is stale and will be closed soon label Oct 1, 2021
@stale stale bot closed this Oct 6, 2021
@geropl geropl deleted the gpl/test-image-env branch December 7, 2021 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants