-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Add integration test to run a helm deploy pipeline #160
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: pivotal-nader-ziada The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/cc @shashwathi |
a772002
to
bfc3646
Compare
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.
I LOVE that all the helm setup is being done via the Pipeline itself! So cool!!
Just a few minor comments, only big thing is the cleanup request :D
/meow space
😍
test/crd_checks.go
Outdated
@@ -30,7 +30,7 @@ import ( | |||
|
|||
const ( | |||
interval = 1 * time.Second | |||
timeout = 2 * time.Minute | |||
timeout = 4 * time.Minute |
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.
at this point, what do you think about adding a timeout
argument to the polling functions, so that each test can pass its own timeout? e.g. the helloworld task probably needs < 1 minute, kaniko needs 2 minutes, this one needs 4 minutes. it will help to keep track of why the timeout is what it is, and also will ensure tests don't wait for longer than they need to
Name: "kaniko", | ||
Image: "gcr.io/kaniko-project/executor", | ||
Args: []string{"--dockerfile=/workspace/Dockerfile", | ||
fmt.Sprintf("--destination=%s", imageName), |
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.
if you wanted, we have templating working now, so you could use Task params for the image name and path
test/helm_task_test.go
Outdated
"--set", | ||
"image.repository=${inputs.params.image}", | ||
}, | ||
}}, |
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.
i think something is off with the indentation b/w these
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.
yes, fixed it
test/helm_task_test.go
Outdated
Name: "helm-init", | ||
Image: "alpine/helm", | ||
Args: []string{"init"}, | ||
}, |
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.
i wonder if the teardown step in the test should invoke a Task or something to remove helm
, so that ppl who run this test aren't left with helm running in their clusters (or will the namespace take care of that?)
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.
no, the namespace will not take care of that, but I was worried if if things fail running another task might not work for whatever reason and I wasn't sure how else to remove it
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.
doesn't the cluster get deleted after the test run in Prow?
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.
I was worried if if things fail running another task might not work for whatever reason and I wasn't sure how else to remove it
That's true, so a couple options:
- Try to do it anyway but don't actually fail anything if the teardown fails (just log it)
- Try to do teardown without using Pipeline/Task, e.g. call out to kubectl
doesn't the cluster get deleted after the test run in Prow?
Yeah I think so! So we're fine for Prow, I'm more concerned about ppl running this on their own clusters.
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.
will get the test green first then add the cleanup
test/helm_task_test.go
Outdated
} | ||
} | ||
|
||
func getelmDeployPipeline(namespace string) *v1alpha1.Pipeline { |
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.
typo?
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.
fixed
@bobcatfish: Bad category. Please see http://thecatapi.com/api/categories/list In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
test/crd_checks.go
Outdated
@@ -30,7 +30,7 @@ import ( | |||
|
|||
const ( | |||
interval = 1 * time.Second | |||
timeout = 2 * time.Minute | |||
timeout = 4 * time.Minute |
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.
Is there a reason why we had to increase the timeout?
test/helm_task_test.go
Outdated
} | ||
|
||
logger.Infof("Creating Pipeline %s", helmDeployPipelineName) | ||
if _, err := c.PipelineClient.Create(getelmDeployPipeline(namespace)); err != nil { |
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.
spelling mistake. getelmDeployPipeline
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.
fixed
test/helm_task_test.go
Outdated
t.Errorf("Error getting service at %s %s", helmDeployServiceName, err) | ||
} | ||
var serviceIp string | ||
ingress := k8sService.Status.LoadBalancer.Ingress |
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 might result in null pointer exception if there was an error above in L97.
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.
will add a check
test/helm_task_test.go
Outdated
} | ||
} | ||
|
||
func getelmDeployPipeline(namespace string) *v1alpha1.Pipeline { |
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.
fix spell error.
test/helm_task_test.go
Outdated
} | ||
} | ||
|
||
func getelmDeployPipelineRun(namespace string) *v1alpha1.PipelineRun { |
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.
fix spell error
/meow space |
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
eb2c3b6
to
0f03523
Compare
d45879f
to
323f693
Compare
Added cleanup task after the test is runs to remove tiller from cluster |
323f693
to
8da149e
Compare
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.
Looks like this is almost done!!
test/helm_task_test.go
Outdated
} | ||
|
||
// cleanup task to remove helm from cluster, will not fail the test if it fails, just log | ||
removeHelmFromCluster(c, t, namespace, logger) |
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.
i think we should make sure this runs if the test is interrupted or fails, e.g. like we do with the teardown
(and/or move it to the teardown):
knativetest.CleanupOnInterrupt(func() { tearDown(logger, c.KubeClient, namespace) }, logger)
defer tearDown(logger, c.KubeClient, namespace)
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.
ok
- tektoncd#63 - create a pipeline of two tasks, - first task build and push an image - second task helm deploys that image - verify the service created is reachable
- Before a pipeline run creates a taskrun for the next task, it needs to check the passed constraints to respect dependecnies between tasks - add implementation of canTaskRun and unit tests - add a task to delete tiller at the end of the helm task test
8da149e
to
725a946
Compare
- call helm cleanup if test is interrupted or fails - cleanup service account and cluster role binding
725a946
to
1427334
Compare
Just a quick note that we should leave #63 open after this b/c we still need to do some work to respect the cluster parameters (e.g. mount and create a kubeconfig that helm can use?). At the moment, we can only deploy to the cluster that the Pipeline CRD is already running in. (Apologies if I added this comment already, I thought I did but I can't find it 😅 ) |
5c1ccac
to
a5478f8
Compare
@bobcatfish should the different cluster be a different issue since this is not yet implemented in the controllers? |
/hold |
b85dbad
to
4adfd60
Compare
will follow up with another pr to update helm test to use this instead of external repo, but need it to be in git source
/retest |
@tejal29 can you take another look, pr is ready for review now. Thanks The only thing remaining is to not use the external repo, but will have to do another pr to change that because we need the folder in test to exist first in the soure repo. |
/hold cancel |
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.
Perfect!
/lgtm
This PR also addresses : #148 |
sure that's fine! |
Related to: #63
Proposed changes
/cc @bobcatfish