-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Let Kaniko E2E test work with a KO_DOCKER_REPO env
If test runner set a KO_DOCKER_REPO variable, use it, so we run the tests against an external container registry. If not set, the kaniko tests will spin up its own local registry. Bring back the GCP secret support so this works in the existing CI, but also supports the case where KO_DOCKER_REPO points to a container registry where no secret required, like in the kind based tests. Add a "test_setup" function to the e2e script, which is picked up after the setup of the cluster, which provisions a GCP service account to be used by tests via the GCP_SERVICE_ACCOUNT_KEY_PATH env variable. Since the local registry runs on HTTP (not HTTPS), the local registry approach does not work for the helm test as the kubelet tries to use HTTPS. If KO_DOCKER_REPO is not specified we either fail or skip the test (no change in behaviour) depending on the value of missingKoFatal This setup makes it easier to run E2E tests in different environments, where a registry may or may not be available. Signed-off-by: Andrea Frittoli <andrea.frittoli@uk.ibm.com>
- Loading branch information
Showing
6 changed files
with
180 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// +build e2e | ||
|
||
/* | ||
Copyright 2019 The Tekton Authors | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package test | ||
|
||
import ( | ||
"errors" | ||
"fmt" | ||
"os" | ||
) | ||
|
||
func getDockerRepo(name string) (string, error) { | ||
// according to knative/test-infra readme (https://github.com/knative/test-infra/blob/13055d769cc5e1756e605fcb3bcc1c25376699f1/scripts/README.md) | ||
// the KO_DOCKER_REPO will be set with according to the project where the cluster is created | ||
// it is used here to dynamically get the docker registry to push the image to | ||
dockerRepo := os.Getenv("KO_DOCKER_REPO") | ||
if dockerRepo == "" { | ||
return "", errors.New("KO_DOCKER_REPO env variable is not set") | ||
} | ||
return fmt.Sprintf("%s/%s", dockerRepo, name), nil | ||
} |