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

extended: fixed registry tests #15807

Merged

Conversation

miminar
Copy link

@miminar miminar commented Aug 17, 2017

The extended test suite now secures the registry. This patch allows for
secure connection to the registry.

Resolves #15763

@openshift-merge-robot openshift-merge-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Aug 17, 2017
@miminar
Copy link
Author

miminar commented Aug 17, 2017

/assign @stevekuznetsov

This is a second PR to address #15763.

There will be one more to resolve:

• Failure [138.715 seconds]
[imageapis][registry] image signature workflow
/go/src/github.com/openshift/origin/_output/local/go/src/github.com/openshift/origin/test/extended/registry/signature.go:113
  can push a signed image to openshift registry and verify it [It]
  /go/src/github.com/openshift/origin/_output/local/go/src/github.com/openshift/origin/test/extended/registry/signature.go:112

  Expected
      <string>: error verifying signature sha256:9a88965479ffee0b415ccd63ddb19ab16ff36c2de3b33dd2a9f1899919e2f569@3ca3e534347bbb4b6617d3bd25ccc52d for image sha256:9a88965479ffee0b415ccd63ddb19ab16ff36c2de3b33dd2a9f1899919e2f569 (verification status will be removed): failed to get image "sha256:9a88965479ffee0b415ccd63ddb19ab16ff36c2de3b33dd2a9f1899919e2f569" manifest: Get http://docker-registry.default.svc:5000/v2/: malformed HTTP response "\x15\x03\x01\x00\x02\x02"
  to contain substring
      <string>: identity is now confirmed

… which is a bit more difficult.

@miminar
Copy link
Author

miminar commented Aug 17, 2017

/cc @dmage

if getErr == nil {
break
}
fmt.Fprintf(g.GinkgoWriter, "failed to %s %s: %v (%#+v)\n", req.Method, req.URL, err, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

err, err? Does it make sense to print the same error in two different ways?

Copy link
Author

Choose a reason for hiding this comment

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

If the error is a wrapper for some other errors, %#+v will not render the embedded string.

@dmage
Copy link
Contributor

dmage commented Aug 17, 2017

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Aug 17, 2017
resp *http.Response
getErr error
)
for _, schema := range []string{"https", "http"} {
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of having logic here from the ordering of these in the list, could make it more explicit:

func MirrorBlobInRegistry(oc *exutil.CLI, dgst digest.Digest, repository string, timeout time.Duration) error {
    // ...
	c := http.Client{
		Transport: knet.SetTransportDefaults(&http.Transport{
			TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
		}),
	}

	func getBlob(schema string) (*http.Request, *http.Response, error) {
		req, err := http.NewRequest("GET", fmt.Sprintf("%s://%s/v2/%s/blobs/%s", schema, registryURL, repository, dgst.String()), nil)
		if err != nil {
			return req, nil, err
		}
		req.Header.Set("range", "bytes=0-1")
		req.Header.Set("Authorization", "Bearer "+token)
		resp, err := c.Do(req)
		return req, resp, err
	}

	var (
		req    *http.Request
		resp   *http.Response
		getErr error
	)
	if req, resp, getErr = getBlob("https"); getErr != nil {
		// fallback to http (why is this appropriate?)
		if req, resp, getErr = getBlob("http"); getErr != nil {
			fmt.Fprintf(g.GinkgoWriter, "failed to %s %s: %v (%#+v)\n", req.Method, req.URL, err, err)
			return getErr
		}
	}
    // ...
}

Copy link
Author

Choose a reason for hiding this comment

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

Good suggestion. Rewritten with a slight modification.

@openshift-merge-robot openshift-merge-robot removed the lgtm Indicates that a PR is ready to be merged. label Sep 4, 2017
@miminar
Copy link
Author

miminar commented Sep 4, 2017

@stevekuznetsov please take a look again.

@miminar miminar closed this Sep 4, 2017
@miminar miminar reopened this Sep 4, 2017
@miminar
Copy link
Author

miminar commented Sep 6, 2017

@stevekuznetsov has extended_image_registry test been somehow disabled? I see it neither among tests nor in PR test history.

@stevekuznetsov
Copy link
Contributor

/test extended_image_registry

1 similar comment
@stevekuznetsov
Copy link
Contributor

/test extended_image_registry

@stevekuznetsov
Copy link
Contributor

@miminar robot is misbehaving. Will be taken care of.

@stevekuznetsov
Copy link
Contributor

/test extended_image_registry

@stevekuznetsov
Copy link
Contributor

Working now!

@miminar
Copy link
Author

miminar commented Sep 6, 2017

@stevekuznetsov 👍 🍺

@jim-minter jim-minter removed their assignment Sep 6, 2017
@miminar
Copy link
Author

miminar commented Sep 6, 2017

Flake #16143 once again:

Failure summary:


  1. Hosts:    localhost
     Play:     Verify Requirements
     Task:     openshift_health_check
     Message:  One or more checks failed
     Details:  check "package_version":
               Not all of the required packages are available at their requested version
               docker:1.12 
               Please check your subscriptions and enabled repositories.

@stevekuznetsov I thought you've disabled the check. Does it need to be disabled on its own for the extended test?

@stevekuznetsov
Copy link
Contributor

Ugh -- we have an issue with an old version of the config being around in the base AMI right now, and the extended job does not explicitly refresh the repo -- new AMIs are being built but it may take a couple hours for them to be ready

@miminar
Copy link
Author

miminar commented Sep 7, 2017

The extended registry tests got broken again (6 out of 14 fail). Not sure, what's the cause. I'll try to fix them in this PR.

: [Feature:ImagePrune] Image hard prune should delete orphaned blobs 1m20s
/tmp/openshift/build-rpm-release/tito/rpmbuild-originutGOgZ/BUILD/origin-3.7.0/_output/local/go/src/github.com/openshift/origin/test/extended/images/hardprune.go:56
Expected error:
    <*util.ExitError | 0xc421186b70>: {
        Cmd: "oc exec --config=/etc/origin/master/admin.kubeconfig --namespace=default --stdin docker-registry-4-qwpbh -- /bin/sh -s",
        StdErr: "time=\"2017-09-07T14:31:28Z\" level=warning msg=\"Ignoring unrecognized environment variable REGISTRY_CONSOLE_PORT\" \ntime=\"2017-09-07T14:31:28Z\" level=warning msg=\"Ignoring unrecognized environment variable REGISTRY_CONSOLE_PORT_9000_TCP\" \ntime=\"2017-09-07T14:31:28Z\" level=warning msg=\"Ignoring unrecognized environment variable REGISTRY_CONSOLE_PORT_9000_TCP_ADDR\" \ntime=\"2017-09-07T14:31:28Z\" level=warning msg=\"Ignoring unrecognized environment variable REGISTRY_CONSOLE_PORT_9000_TCP_PORT\" \ntime=\"2017-09-07T14:31:28Z\" level=warning msg=\"Ignoring unrecognized environment variable REGISTRY_CONSOLE_PORT_9000_TCP_PROTO\" \ntime=\"2017-09-07T14:31:28Z\" level=warning msg=\"Ignoring unrecognized environment variable REGISTRY_CONSOLE_SERVICE_HOST\" \ntime=\"2017-09-07T14:31:28Z\" level=warning msg=\"Ignoring unrecognized environment variable REGISTRY_CONSOLE_SERVICE_PORT\" \ntime=\"2017-09-07T14:31:28Z\" level=warning msg=\"Ignoring unrecognized environment variable REGISTRY_CONSOLE_SERVICE_PORT_REGISTRY_CONSOLE\" \ntime=\"2017-09-07T14:31:28.821345689Z\" level=info msg=\"start prune\" distribution_version=\"v2.6.2+unknown\" kubernetes_version=v1.7.0+695f48a16f openshift_version=v3.7.0-alpha.1+d918faf-203 \ntime=\"2017-09-07T14:31:28.892326316Z\" level=error msg=\"filesystem: Path not found: /docker/registry/v2/blobs\" \nDeleted 0 blobs\nFreed up 0 B of disk space\ncommand terminated with exit code 1",
        ExitError: {
            ProcessState: {
                pid: 28630,
                status: 256,
                rusage: {
                    Utime: {Sec: 0, Usec: 198041},
                    Stime: {Sec: 0, Usec: 36869},
                    Maxrss: 49684,
                    Ixrss: 0,
                    Idrss: 0,
                    Isrss: 0,
                    Minflt: 13342,
                    Majflt: 0,
                    Nswap: 0,
                    Inblock: 0,
                    Oublock: 0,
                    Msgsnd: 0,
                    Msgrcv: 0,
                    Nsignals: 0,
                    Nvcsw: 996,
                    Nivcsw: 11,
                },
            },
            Stderr: nil,
        },
    }
    exit status 1
not to have occurred
/tmp/openshift/build-rpm-release/tito/rpmbuild-originutGOgZ/BUILD/origin-3.7.0/_output/local/go/src/github.com/openshift/origin/test/extended/images/hardprune.go:55from junit_02.xml
Filter through log files

: [Feature:ImagePrune] Image hard prune should show orphaned blob deletions in dry-run mode 1m3s
/tmp/openshift/build-rpm-release/tito/rpmbuild-originutGOgZ/BUILD/origin-3.7.0/_output/local/go/src/github.com/openshift/origin/test/extended/images/hardprune.go:355
Expected error:
    <*util.ExitError | 0xc421940bd0>: {
        Cmd: "oc tag --config=/tmp/extended-test-prune-images-22wpb-vn6sq-user.kubeconfig --namespace=extended-test-prune-images-22wpb-vn6sq --source=istag a:latest a-tagged:latest",
        StdErr: "error: \"a:latest\" is not currently pointing to an image, cannot use it as the source of a tag",
        ExitError: {
            ProcessState: {
                pid: 37493,
                status: 256,
                rusage: {
                    Utime: {Sec: 0, Usec: 182447},
                    Stime: {Sec: 0, Usec: 27149},
                    Maxrss: 49776,
                    Ixrss: 0,
                    Idrss: 0,
                    Isrss: 0,
                    Minflt: 13335,
                    Majflt: 0,
                    Nswap: 0,
                    Inblock: 0,
                    Oublock: 0,
                    Msgsnd: 0,
                    Msgrcv: 0,
                    Nsignals: 0,
                    Nvcsw: 844,
                    Nivcsw: 4,
                },
            },
            Stderr: nil,
        },
    }
    exit status 1
not to have occurred
/tmp/openshift/build-rpm-release/tito/rpmbuild-originutGOgZ/BUILD/origin-3.7.0/_output/local/go/src/github.com/openshift/origin/test/extended/images/hardprune.go:129from junit_02.xml
Filter through log files

: [Feature:ImagePrune] Image prune of schema 1 should prune old image 1m53s
/tmp/openshift/build-rpm-release/tito/rpmbuild-originutGOgZ/BUILD/origin-3.7.0/_output/local/go/src/github.com/openshift/origin/test/extended/images/prune.go:68
Expected
    <string>: application/vnd.docker.distribution.manifest.v2+json
to equal
    <string>: application/vnd.docker.distribution.manifest.v1+json
/tmp/openshift/build-rpm-release/tito/rpmbuild-originutGOgZ/BUILD/origin-3.7.0/_output/local/go/src/github.com/openshift/origin/test/extended/images/prune.go:169from junit_02.xml
Filter through log files

: [Feature:ImageQuota] Image limit range should deny a push of built image exceeding limit on openshift.io/images resource 1m58s
/tmp/openshift/build-rpm-release/tito/rpmbuild-originutGOgZ/BUILD/origin-3.7.0/_output/local/go/src/github.com/openshift/origin/test/extended/imageapis/limitrange_admission.go:123
Expected error:
    <*errors.errorString | 0xc42041aa90>: {
        s: "Failed to match expected \"(?i)requested access to the resource is denied|failed to push image: denied|^denied$\" in: \"2017-09-07T14:32:31.228951000Z Receiving source from STDIN as archive ...\\n2017-09-07T14:32:40.003419000Z Step 1 : FROM scratch\\n2017-09-07T14:32:40.003958000Z  ---> \\n2017-09-07T14:32:40.004471000Z Step 2 : COPY data1 /data1\\n2017-09-07T14:32:43.638010000Z  ---> efa3efcc320b\\n2017-09-07T14:32:43.899235000Z Removing intermediate container 2ae9ea13b75b\\n2017-09-07T14:32:43.899703000Z Step 3 : COPY data2 /data2\\n2017-09-07T14:32:46.452883000Z  ---> ad0a53b55d25\\n2017-09-07T14:32:46.625080000Z Removing intermediate container 6ea1a7db281c\\n2017-09-07T14:32:46.627349000Z Step 4 : ENV \\\"OPENSHIFT_BUILD_NAME\\\" \\\"sized-3\\\" \\\"OPENSHIFT_BUILD_NAMESPACE\\\" \\\"extended-test-limitrange-admission-c18d5-290lc\\\"\\n2017-09-07T14:32:47.373392000Z  ---> Running in 15762662be8d\\n2017-09-07T14:32:48.540727000Z  ---> 6d09333b7736\\n2017-09-07T14:32:48.569853000Z Removing intermediate container 15762662be8d\\n2017-09-07T14:32:48.570246000Z Step 5 : LABEL \\\"io.openshift.build.name\\\" \\\"sized-3\\\" \\\"io.openshift.build.namespace\\\" \\\"extended-test-limitrange-admission-c18d5-290lc\\\"\\n2017-09-07T14:32:49.365946000Z  ---> Running in 0927402e3646\\n2017-09-07T14:32:51.514398000Z  ---> 7ef3371b7f6c\\n2017-09-07T14:32:51.904800000Z Removing intermediate container 0927402e3646\\n2017-09-07T14:32:51.906489000Z Successfully built 7ef3371b7f6c\"",
    }
    Failed to match expected "(?i)requested access to the resource is denied|failed to push image: denied|^denied$" in: "2017-09-07T14:32:31.228951000Z Receiving source from STDIN as archive ...\n2017-09-07T14:32:40.003419000Z Step 1 : FROM scratch\n2017-09-07T14:32:40.003958000Z  ---> \n2017-09-07T14:32:40.004471000Z Step 2 : COPY data1 /data1\n2017-09-07T14:32:43.638010000Z  ---> efa3efcc320b\n2017-09-07T14:32:43.899235000Z Removing intermediate container 2ae9ea13b75b\n2017-09-07T14:32:43.899703000Z Step 3 : COPY data2 /data2\n2017-09-07T14:32:46.452883000Z  ---> ad0a53b55d25\n2017-09-07T14:32:46.625080000Z Removing intermediate container 6ea1a7db281c\n2017-09-07T14:32:46.627349000Z Step 4 : ENV \"OPENSHIFT_BUILD_NAME\" \"sized-3\" \"OPENSHIFT_BUILD_NAMESPACE\" \"extended-test-limitrange-admission-c18d5-290lc\"\n2017-09-07T14:32:47.373392000Z  ---> Running in 15762662be8d\n2017-09-07T14:32:48.540727000Z  ---> 6d09333b7736\n2017-09-07T14:32:48.569853000Z Removing intermediate container 15762662be8d\n2017-09-07T14:32:48.570246000Z Step 5 : LABEL \"io.openshift.build.name\" \"sized-3\" \"io.openshift.build.namespace\" \"extended-test-limitrange-admission-c18d5-290lc\"\n2017-09-07T14:32:49.365946000Z  ---> Running in 0927402e3646\n2017-09-07T14:32:51.514398000Z  ---> 7ef3371b7f6c\n2017-09-07T14:32:51.904800000Z Removing intermediate container 0927402e3646\n2017-09-07T14:32:51.906489000Z Successfully built 7ef3371b7f6c"
not to have occurred
/tmp/openshift/build-rpm-release/tito/rpmbuild-originutGOgZ/BUILD/origin-3.7.0/_output/local/go/src/github.com/openshift/origin/test/extended/imageapis/limitrange_admission.go:99from junit_02.xml
Filter through log files

: [Feature:ImageQuota] Image limit range should deny a push of built image exceeding openshift.io/Image limit 40s
/tmp/openshift/build-rpm-release/tito/rpmbuild-originutGOgZ/BUILD/origin-3.7.0/_output/local/go/src/github.com/openshift/origin/test/extended/imageapis/limitrange_admission.go:70
Expected
    <bool>: false
to be true
/tmp/openshift/build-rpm-release/tito/rpmbuild-originutGOgZ/BUILD/origin-3.7.0/_output/local/go/src/github.com/openshift/origin/test/extended/images/helper.go:212from junit_02.xml
Filter through log files

: [imageapis][registry] image signature workflow can push a signed image to openshift registry and verify it 5m7s
/tmp/openshift/build-rpm-release/tito/rpmbuild-originutGOgZ/BUILD/origin-3.7.0/_output/local/go/src/github.com/openshift/origin/test/extended/registry/signature.go:112
Expected error:
    <*errors.errorString | 0xc42026e740>: {
        s: "timed out while waiting of an image stream tag extended-test-registry-signing-p3rtw-w5vnx/signer:latest",
    }
    timed out while waiting of an image stream tag extended-test-registry-signing-p3rtw-w5vnx/signer:latest
not to have occurred
/tmp/openshift/build-rpm-release/tito/rpmbuild-originutGOgZ/BUILD/origin-3.7.0/_output/local/go/src/github.com/openshift/origin/test/extended/registry/signature.go:33

@miminar
Copy link
Author

miminar commented Oct 11, 2017

/retest
/test extended_image_registry

if err != nil {
return fmt.Errorf("failed to get registry pod: %v", err)
}
path, err := oc.Run("logs").Args("dc/docker-registry").OutputToFile("pod-" + pod.Name + ".log")
Copy link
Contributor

Choose a reason for hiding this comment

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

@jim-minter if you want to change the Pod log dumping logic to put it in a file, this looks like a promising way to do it instead of spamming the stdout.

Copy link
Contributor

Choose a reason for hiding this comment

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

@bparees yes, but currently it ends up in /tmp, not as an artifact.

Copy link
Contributor

Choose a reason for hiding this comment

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

well that's not very useful... and it makes me think @miminar should update this to dump to stdout then because this won't be accessible when the job is done, right?

(or use one of the existing DumpPodLogs methods)

Copy link
Contributor

Choose a reason for hiding this comment

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

+1, @miminar I don't think this output will be retrievable when run in the CI system?

Copy link
Author

Choose a reason for hiding this comment

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

+1, @miminar I don't think this output will be retrievable when run in the CI system?

I was happy using it locally. I didn't realize it won't be preserved in CI system.
Addressed by #16859

@bparees
Copy link
Contributor

bparees commented Oct 11, 2017

this lgtm but should probably be split into two prs, one that's changing the extended test infrastructure and one for the imageregistry test changes.

I also want @stevekuznetsov and/or @smarterclayton to sign off on the extended test infrastructure changes.

@bparees
Copy link
Contributor

bparees commented Oct 11, 2017

/unassign @dcbw
/assign

@openshift-ci-robot openshift-ci-robot assigned bparees and unassigned dcbw Oct 11, 2017
@miminar miminar force-pushed the registry-extended-test-fixes branch from 4b4ea2c to e8350eb Compare October 11, 2017 15:34
@openshift-ci-robot openshift-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Oct 11, 2017
@miminar
Copy link
Author

miminar commented Oct 11, 2017

this lgtm but should probably be split into two prs, one that's changing the extended test infrastructure and one for the imageregistry test changes.

done. The reworked FOCUS commit has been extracted to #16806

/test extended_image_registry

@@ -40,7 +40,8 @@ var _ = g.Describe("[Feature:ImageQuota] Image limit range", func() {
deleteTestImagesAndStreams(oc)
}

g.It(fmt.Sprintf("should deny a push of built image exceeding %s limit", imageapi.LimitTypeImage), func() {
g.It(fmt.Sprintf("[Skipped] should deny a push of built image exceeding %s limit", imageapi.LimitTypeImage), func() {
g.Skip("FIXME: fill image metadata for schema1 in the registry")
Copy link
Contributor

Choose a reason for hiding this comment

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

do we have an issue for this? if not, please open one to track fixing this.

@@ -21,6 +22,7 @@ var _ = g.Describe("[imageapis][registry] image signature workflow", func() {
)

g.It("can push a signed image to openshift registry and verify it", func() {
g.Skip("FIXME: fix oadm verify-image-signature to work with secured registry")
Copy link
Contributor

Choose a reason for hiding this comment

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

same here, please open an issue to track fixing this if we don't have one.

@bparees
Copy link
Contributor

bparees commented Oct 11, 2017

@miminar please squash the commits and lgtm. (also please open issues to track enabling the currently skipped tests, if we don't have issues for that already)

@bparees
Copy link
Contributor

bparees commented Oct 11, 2017

(and take the hold label off the PR assuming you're ready for it to be merged)

@bparees
Copy link
Contributor

bparees commented Oct 11, 2017

/unassign @stevekuznetsov

The extended test suite now secures the registry. This patch allows for
secure connection to the registry.

Mark few registry tests as serial. Prevent them from being run parallel
with some other registry tests.

Write registry log to file on re-deployment. The registry log is
essential for externded test debugging. Without writing it to a file,
this information will be lost.

Skip image signature workflow test until we figure out, how to make
`oadm verify-image-signature` work with secured integrated Docker
registry. Issue openshift#16344.

Temporarily skip limitrange_admission test. The image size counting is
still broken for schema 1 - the layer sizes need to be filled on registry
side. Will be fixed by openshift#16776.

Signed-off-by: Michal Minář <miminar@redhat.com>
@miminar miminar force-pushed the registry-extended-test-fixes branch from e8350eb to 9632e0e Compare October 12, 2017 09:14
@miminar
Copy link
Author

miminar commented Oct 12, 2017

Here's issue for the skipped signature workflow test: #16344
And here's a PR for the other skipped test: #16776
Squashed. Removing hold label.

@miminar miminar removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 12, 2017
@bparees
Copy link
Contributor

bparees commented Oct 12, 2017

/retest
/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 12, 2017
@openshift-merge-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bparees, dmage, kargakis, miminar

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

Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@openshift-merge-robot
Copy link
Contributor

Automatic merge from submit-queue.

@openshift-merge-robot openshift-merge-robot merged commit 18c29ac into openshift:master Oct 12, 2017
openshift-merge-robot added a commit that referenced this pull request Oct 15, 2017
Automatic merge from submit-queue.

extended: log registry pod to artifacts directory

To preserve it for post-CI-job-debugging.

Follow-up for #15807
Addresses comment #15807 (comment)
@miminar miminar deleted the registry-extended-test-fixes branch November 8, 2017 09:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants