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: allow testing frontends from different version #5594

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tonistiigi
Copy link
Member

This allows running Dockerfile tests so that the Dockerfile version and the BuildKit version are from different commits so that we can test that old Dockerfile releases remain compatible with the latest BuildKit.

The tests are based on the commit of the Dockerfile frontend as we can't expect that new test would work on old frontends. In future we might consider doing it the other way as well but then we need a way to mark tests that can be ignored if they are not expected to pass because of a new feature dependency.

Example:

DOCKERFILE_RELEASES=mainline TEST_SUITE_CONTEXT=https://github.com/moby/buildkit.git#v0.17.0 TESTPKGS=./frontend/dockerfile TESTFLAGS="-v --run /TestDockerignore$/"  ./hack/test dockerfile

This doesn't update Github workflows to trigger tests like this yet. We wouldn't do this for PRs but in follow up we should set up a matrix that can be run manually or via cron. cc @crazy-max . Atm. I have not run through the full test suites yet for previous release versions, so not sure if we will find some issues.

Choose a reason for hiding this comment

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

Copilot reviewed 1 out of 6 changed files in this pull request and generated no comments.

Files not reviewed (5)
  • docker-bake.hcl: Language not supported
  • frontend/dockerfile/cmd/dockerfile-frontend/hack/release: Language not supported
  • hack/images: Language not supported
  • hack/test: Language not supported
  • hack/util: Language not supported
@tonistiigi tonistiigi force-pushed the dockerfile-test-versioning branch from ee0c989 to 1f94cab Compare December 13, 2024 06:58
if [ -n "$TEST_SUITE_CONTEXT" ]; then
export TEST_BINARIES_CONTEXT=$currentcontext
# FIXME: something breaks with the syntax when using the context
export BUILDKIT_SYNTAX="docker/dockerfile:1.10.0"
Copy link
Member Author

Choose a reason for hiding this comment

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

this is fixed by #5596

This allows running Dockerfile tests so that the Dockerfile
version and the BuildKit version are from different commits so
that we can test that old Dockerfile releases remain compatible
with the latest BuildKit.

The tests are based on the commit of the Dockerfile frontend as
we can't expect that new test would work on old frontends. In future
we might consider doing it the other way as well but then we need
a way to mark tests that can be ignored if they are not expected to
pass because of a new feature dependency.

Signed-off-by: Tonis Tiigi <[email protected]>
@tonistiigi tonistiigi force-pushed the dockerfile-test-versioning branch from 1f94cab to 69034c3 Compare December 14, 2024 04:14
@crazy-max
Copy link
Member

This doesn't update Github workflows to trigger tests like this yet. We wouldn't do this for PRs but in follow up we should set up a matrix that can be run manually or via cron. cc @crazy-max . Atm. I have not run through the full test suites yet for previous release versions, so not sure if we will find some issues.

I will look at this, we might need something similar to CheckFeatureCompat that we use in our test suites.

@tonistiigi
Copy link
Member Author

I will look at this, we might need something similar to CheckFeatureCompat that we use in our test suites.

I think we should first get the version where we test the specific version of buildkit against release versions of Dockerfile running continuously.

Then we can look at what the test results look like for different combinations. It isn't as easy as CheckFeatureCompat to cover all possible combinations of all possible tests I don't want to be in situation where we have ~100 strings definitions for featurecompat. I think it will more look like marking some tests to be skipped(likely on runner side) when running specific combinations as we have manually checked that failure in this test is expected.

@tonistiigi
Copy link
Member Author

tonistiigi commented Dec 19, 2024

Initial summary for test matrix at https://github.com/moby/buildkit/actions/runs/12385930256 (against current master)

  • 1.12.x, 1.11.x clean
  • 1.10.x 5 test failures per worker + subtests. Some are obviously string changes in error messages. Some not so obvious. I did verify all the failures locally so they look debuggable. From the list, TestErrorsSourceMap is most confusing to me and maybe could be related to proto changes. I've copied the outputs below. I've also verified that these tests do pass with matching buildkit daemon, so not just problem of pipeline getting old.
  • 1.9.x Looks similar to 1.10.x , TestCopyIgnoredFiles is extra. TestErrorsSourceMap is also on the list so I guess that rules out proto changes.
  • < 1.8.x doesn't build because we are installing gocovmerge@latest instead of a pinned version https://github.com/moby/buildkit/blob/dockerfile/1.10.0/Dockerfile#L308 and new version now requires newer Go. This issue may also break newer releases in the future when gocovmerge raises its minimum version.

I think the failures are worth debugging but probably not extremely critical. We do need some solution for exceptions though and can't expect everything to be green. Maybe instead of managing patches it just makes sense to create extra branches for old releases where the test fixes can be applied and test these branches instead. Eg. there we can pin gocovmerge to old version and update the expected error message. It would still mean that you can't test every combination, only against the latest daemon.

None of this should be a blocker to getting this PR in.

2024-12-18T03:55:39.1678611Z === RUN   TestIntegration/TestProvenanceAttestation/worker=oci/frontend=gateway/max
2024-12-18T03:55:39.4933451Z     dockerfile_provenance_test.go:231: 
2024-12-18T03:55:39.4936009Z         	Error Trace:	/src/frontend/dockerfile/dockerfile_provenance_test.go:231
2024-12-18T03:55:39.4936628Z         	Error:      	Not equal: 
2024-12-18T03:55:39.4937040Z         	            	expected: 2
2024-12-18T03:55:39.4937407Z         	            	actual  : 0
2024-12-18T03:55:39.4938216Z         	Test:       	TestIntegration/TestProvenanceAttestation/worker=oci/frontend=gateway/max



2024-12-18T03:58:49.4877878Z === FAIL: frontend/dockerfile TestIntegration/TestProvenanceAttestation/worker=oci/frontend=gateway/#00 (1.05s)
2024-12-18T03:58:49.4878159Z time="2024-12-18T03:55:38Z" level=info msg="trying next host - response was http.StatusNotFound" host="localhost:40461"
2024-12-18T03:58:49.4878247Z     dockerfile_provenance_test.go:231: 
2024-12-18T03:58:49.4878437Z         	Error Trace:	/src/frontend/dockerfile/dockerfile_provenance_test.go:231
2024-12-18T03:58:49.4878511Z         	Error:      	Not equal: 
2024-12-18T03:58:49.4878635Z         	            	expected: 2
2024-12-18T03:58:49.4878705Z         	            	actual  : 0
2024-12-18T03:58:49.4878928Z         	Test:       	TestIntegration/TestProvenanceAttestation/worker=oci/frontend=gateway/#00
2024-12-18T03:58:49.4879185Z         --- FAIL: TestIntegration/TestProvenanceAttestation/worker=oci/frontend=gateway/#00 (1.05s)
2024-12-18T03:58:49.4879194Z 
2024-12-18T03:58:49.4879595Z === FAIL: frontend/dockerfile TestIntegration/TestProvenanceAttestation/worker=oci/frontend=gateway/max (0.32s)
2024-12-18T03:58:49.4879682Z     dockerfile_provenance_test.go:231: 
2024-12-18T03:58:49.4879865Z         	Error Trace:	/src/frontend/dockerfile/dockerfile_provenance_test.go:231
2024-12-18T03:58:49.4879938Z         	Error:      	Not equal: 
2024-12-18T03:58:49.4880003Z         	            	expected: 2
2024-12-18T03:58:49.4880074Z         	            	actual  : 0
2024-12-18T03:58:49.4880288Z         	Test:       	TestIntegration/TestProvenanceAttestation/worker=oci/frontend=gateway/max
2024-12-18T03:58:49.4880536Z         --- FAIL: TestIntegration/TestProvenanceAttestation/worker=oci/frontend=gateway/max (0.32s)
2024-12-18T03:58:49.4880541Z 

2024-12-18T03:56:38.6960166Z     dockerfile_test.go:8001: 
2024-12-18T03:56:38.6960772Z         	Error Trace:	/src/frontend/dockerfile/dockerfile_test.go:8001
2024-12-18T03:56:38.6961397Z         	            				/src/util/testutil/integration/run.go:97
2024-12-18T03:56:38.6961880Z         	            				/src/util/testutil/integration/run.go:211
2024-12-18T03:56:38.6962357Z         	Error:      	"[]" should have 1 item(s), but has 0
2024-12-18T03:56:38.6962955Z         	Test:       	TestIntegration/TestHistoryError/worker=oci/frontend=gateway

2024-12-18T03:56:41.0798525Z     dockerfile_provenance_test.go:1510: 
2024-12-18T03:56:41.0799401Z         	Error Trace:	/src/frontend/dockerfile/dockerfile_provenance_test.go:1510
2024-12-18T03:56:41.0800226Z         	            				/src/util/testutil/integration/run.go:97
2024-12-18T03:56:41.0800749Z         	            				/src/util/testutil/integration/run.go:211
2024-12-18T03:56:41.0801238Z         	Error:      	Expected value not to be nil.
2024-12-18T03:56:41.0801952Z         	Test:       	TestIntegration/TestDuplicateLayersProvenance/worker=oci/frontend=gateway


2024-12-18T03:56:41.2538382Z     dockerfile_test.go:7692: 
2024-12-18T03:56:41.2541238Z         	Error Trace:	/src/frontend/dockerfile/dockerfile_test.go:7692
2024-12-18T03:56:41.2545427Z         	            				/src/util/testutil/integration/run.go:97
2024-12-18T03:56:41.2545992Z         	            				/src/util/testutil/integration/run.go:211
2024-12-18T03:56:41.2556085Z         	Error:      	Error "failed to solve: failed to marshal local source: cannot marshal empty definition op" does not contain "invalid nil input definition to definition op"
2024-12-18T03:56:41.2568893Z         	Test:       	TestIntegration/TestNilContextInSolveGateway/worker=oci/frontend=gateway

2024-12-18T03:57:24.5506326Z     errors_test.go:98: 
2024-12-18T03:57:24.5507381Z         	Error Trace:	/src/frontend/dockerfile/errors_test.go:98
2024-12-18T03:57:24.5510984Z         	Error:      	Not equal: 
2024-12-18T03:57:24.5511688Z         	            	expected: 1
2024-12-18T03:57:24.5512080Z         	            	actual  : 0
2024-12-18T03:57:24.5512783Z         	Test:       	TestIntegration/TestErrorsSourceMap/worker=oci/frontend=gateway/invalidrun

2024-12-18T03:57:24.7358985Z     errors_test.go:98: 
2024-12-18T03:57:24.7359852Z         	Error Trace:	/src/frontend/dockerfile/errors_test.go:98
2024-12-18T03:57:24.7360558Z         	Error:      	Not equal: 
2024-12-18T03:57:24.7360967Z         	            	expected: 1
2024-12-18T03:57:24.7361479Z         	            	actual  : 0
2024-12-18T03:57:24.7362112Z         	Test:       	TestIntegration/TestErrorsSourceMap/worker=oci/frontend=gateway/invalidcopy


2024-12-18T03:57:25.1896380Z === RUN   TestIntegration/TestErrorsSourceMap/worker=oci/frontend=gateway/invalidmultiline
2024-12-18T03:57:25.4082706Z     errors_test.go:98: 
2024-12-18T03:57:25.4083398Z         	Error Trace:	/src/frontend/dockerfile/errors_test.go:98
2024-12-18T03:57:25.4085300Z         	Error:      	Not equal: 
2024-12-18T03:57:25.4085901Z         	            	expected: 1
2024-12-18T03:57:25.4086268Z         	            	actual  : 0
2024-12-18T03:57:25.4087181Z         	Test:       	TestIntegration/TestErrorsSourceMap/worker=oci/frontend=gateway/invalidmultiline

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants