-
Notifications
You must be signed in to change notification settings - Fork 113
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
[BUILD-372] SHIP-0021: Local Source Upload #934
[BUILD-372] SHIP-0021: Local Source Upload #934
Conversation
7c061e3
to
b0401c6
Compare
5255b56
to
9405356
Compare
b3dadd3
to
d529d40
Compare
3488c85
to
1e1770b
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.
Hi @otaviof looks good mostly. Suggesting that you quickly prepare a separate PR for the base image as this needs to be built first.
// AmendTaskSpecWithSources adds steps, results and volumes for spec.source and spec.sources | ||
// isLocalCopy appends all "Sources" in a single slice, and if any entry is typed "LocalCopy" it | ||
// returns first LocalCopy typed BuildSource found, or nil. | ||
func isLocalCopy(build *buildv1alpha1.Build, buildRun *buildv1alpha1.BuildRun) *buildv1alpha1.BuildSource { |
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.
The name of the function suggests that it returns a boolean. I suggest to chose a name like findLocalCopyBuildSource
.
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.
Indeed, a more complete name makes more sense here. I adopted your suggestion, with a minor modification. Please consider.
// making sure the taskrun is schedule and becomes a pod, since the build-controller will transit | ||
// the object status from empty to unknown, when the actual build starts | ||
Eventually(func() *corev1.ConditionStatus { | ||
status := getBuildRunStatus(buildRunName) | ||
Logf("BuildRun '%s' status '%v'...", buildRunName, status) | ||
return status | ||
}, time.Duration(60*time.Second), 3*time.Second). | ||
Should(Equal(&unknownCondition), "BuildRun should reach unknown condition") | ||
|
||
// asserting the waiter step will end up in timeout, in other words, it ends as failed | ||
Eventually(func() *corev1.ConditionStatus { | ||
status := getBuildRunStatus(buildRunName) | ||
Expect(status).ToNot(BeNil()) | ||
Logf("BuildRun '%s' status '%s'...", buildRunName, *status) | ||
return status | ||
}, time.Duration(90*time.Second), 10*time.Second). | ||
Should(Equal(&falseCondition), "BuildRun should end up in timeout") |
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 suggest to wait for the Reason value (Running in the first block, Failed in the second one) and assert the status. Basically it will be unknown already when the BuildRun is Pending and it can theoretically stay there for a while (waiting for the pod to be scheduled and its images pulled).
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.
Please consider latest changes, I'm using your suggestion and checking the actual "Reason", inside the Condition slice.
I wonder if we should also extend the first block timeout to account for the image pulling time as well.
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.
Right, especially with a lower bandwidth, it might not be enough. For this purpose, there is also the timeout multiplyer that you could add here as well. Like here:
build/test/e2e/validators_test.go
Line 140 in 973ef83
}, time.Duration(1100*getTimeoutMultiplier())*time.Second, 5*time.Second).Should(Equal(trueCondition), "BuildRun did not succeed") |
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.
Thanks for the snippet, it's in place now.
0896b8d
to
ff2c72b
Compare
ff2c72b
to
1cc44f1
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.
Stumbled over one more reference to quay.io.
87b03f9
to
c7b5042
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.
@@ -11,9 +11,12 @@ import ( | |||
// BuildSourceType enumerates build source type names. | |||
type BuildSourceType string | |||
|
|||
// LocalCopy defines a source type that waits for user input, as in a local copy into a POD. | |||
// LocalCopy source type when the user will upload local content. |
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.
not officially asking for a change, but am wondering .... is it truly obvious that "uploading local content" means it is NOT a remote artifact?
Probably the answer is "yes it is obvious", but at least at this precise moment, I have a small percent of uncertainty
But especially when we start adding remote artifact types other than HTTP, perhaps distinguishing that local source is not one of the remote artifacts becomes a bit more important.
I won't push on it further @otaviof but if you are amenable to making it really clear by all means
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.
Probably the answer is "yes it is obvious", but at least at this precise moment, I have a small percent of uncertainty
I think you touch a important subject.
To be honest, at this point, I don't think the local-copy nor the remote-artifacts are depicted well enough. I'm rewording the doc comments for the BuildSource
types, trying to contrast "upload" vs. "download". Please consider.
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.
the comments in question are clearer @otaviof
after reading your comment here and in the code, I think I might even go a step further, and
- change constants starting with RemoteArtifacts... to DownloadedArtfacts...
- change LocalCopy to UploadedArtifacts
WDYT?
e280160
to
7085f2c
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.
ok here is my second pass on the waiter commit @otaviof
a few questions, and perhaps an alternative to your existing waiter implementation that is "simpler" in that it is mainly based off of existing golang utilities (assuming the pid in the file is not required down the line)
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.
Made some minor suggestions. Otherwise, LGTM.
10e3335
to
42d4985
Compare
Thanks, appreciated! |
42d4985
to
7c81013
Compare
7c81013
to
b97643c
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.
Just two more questions regarding the e2e test.
"github.com/shipwright-io/build/test/utils" | ||
) | ||
|
||
var _ = Describe("For a Kubernetes cluster with Tekton and build installed", func() { |
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.
It would be cool to have an e2e test which causes the waiter to successfully complete. Not sure if that's doable.
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 agree! The complete test workflow will initially happen on the CLI repository (as part of PR #86), since it depends on the client to utilize the local source upload feature end-to-end. As per:
Given the approach is consolidated on the CLI side, we can then reuse it here, if we conclude we want it here to.
What do you think about this approach, and, should we create a issue to keep track of 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.
Yes, an issue sounds fine.
Other than a response to my idea of actually changing the names of the structs I'll /approve and let @SaschaSchwarze0 handle LGTM with his remaining comments. @adambkaplan did you want a pass at this before it merges? |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: gabemontero 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 |
Implementing "type" on the BuildSource instances employed for the Remote Artifacts support. Amending tests.
b97643c
to
f12fc44
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.
/lgtm
Changes
Local Source Upload (SHIP-0021)
This PR feature local source upload (SHIP-0021), creating the workflow changes to replace the
git clone
step, by waiting for the content uploaded by the user. The upload is stored in the same original location, the/workspace/source
mount point.To accomplish this task, we employ the
waiter
nested application, which holds the POD running while the upload is performed.In order to trigger the local source upload, the user will need the following
BuildRun
, for instance:The data upload will be performed by our CLI application.
Remote Artifacts
Given the fact there are two types of
BuildSource
supported, the Remote Artifacts is now defined by thetype
attribute. The "HTTP"type
is introduced for this reason.Testing
To run the controller and simulate the changes locally, you'll need a waiter image in place. For that export
WAITER_CONTAINER_IMAGE
, as per:After the changes here are merged, then we can use the regular waiter image.
Submitter Checklist
Release Notes