Skip to content

Add Binary build type, allow binary files to be used to trigger a build - #4819

Merged
openshift-bot merged 9 commits into
openshift:masterfrom
smarterclayton:add_binary_build
Oct 24, 2015
Merged

openshift-bot merged 9 commits into
openshift:masterfrom
smarterclayton:add_binary_build

Conversation

@smarterclayton

Copy link
Copy Markdown
Contributor

Expose /buildconfigs/foo/instantiatebinary which accepts a binary stream
and command line parameters, then attaches to the running builder and streams
input to STDIN. Builder unpacks that based on the binary type and the binary
settings.

@bparees @mfojtik @csrwng fyi, not working yet but close

@smarterclayton

Copy link
Copy Markdown
Contributor Author

@csrwng if you can look at the refactors to build logs (so that I can share the wait code) as well as the package renames to make them consistent (pkg/registry/buildconfiginstantiate, pkg/registry/buildclone etc)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why not? can't i supply some binary artifacts and some git source, together?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

In my head they are conflicting - if you really need that case you can tar
your git repo and binary push. That said, since at any time you can do a
binary build, you want to have a clear way to understand the impact. I
feel like if you provide a directory, it conflicts with something else
providing a dir. If you provide a file it doesn't conflict with a dir, and
vice versa. Layering requires order decisions, and that scares me.

On Sep 28, 2015, at 4:38 PM, Ben Parees [email protected] wrote:

In pkg/build/api/validation/validation.go
#4819 (comment):

  •     allErrs = append(allErrs, validateDockerfile(*input.Dockerfile)...)
    
  • }
    
  • if input.Binary != nil {
    
  •     allErrs = append(allErrs, fielderrors.NewFieldInvalid("binary", "", "may not be set when type is Git"))
    
  • }
    
  • case buildapi.BuildSourceBinary:
  • if input.Binary == nil {
    
  •     allErrs = append(allErrs, fielderrors.NewFieldRequired("binary"))
    
  • } else {
    
  •     allErrs = append(allErrs, validateBinarySource(input.Binary).Prefix("binary")...)
    
  • }
    
  • if input.Dockerfile != nil {
    
  •     allErrs = append(allErrs, validateDockerfile(*input.Dockerfile)...)
    
  • }
    
  • if input.Git != nil {
    
  •     allErrs = append(allErrs, fielderrors.NewFieldInvalid("git", "", "may not be set when type is Binary"))
    

why not? can't i supply some binary artifacts and some git source, together?

—
Reply to this email directly or view it on GitHub
https://github.com/openshift/origin/pull/4819/files#r40559076.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Layering requires order decisions, and that scares me.

except that you did sign up for layering with the separate Dockerfile + binarysource support. but yes in general i agree.

@bparees

bparees commented Sep 28, 2015

Copy link
Copy Markdown
Contributor

what happens when i clone a build created in this way? (oc start-build --from-build=previous_build)?

what happens when i have an image change trigger associated with a build like this and it gets triggered?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

need godoc?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

still needs godoc.

@csrwng

csrwng commented Sep 29, 2015

Copy link
Copy Markdown
Contributor

@smarterclayton do we need to have the build be the main process of the build pod? Could we not start a build watcher process and then simply exec with stdin into the pod once that's running? That wouldn't require any changes to exec. Same could apply to a running pod that we want to do a binary deploy to.

@smarterclayton

Copy link
Copy Markdown
Contributor Author

Image change triggers and webhooks probably have to be disallowed in the
short term. In the future, we could cache build input in a store (or
incremental flow) and allow it to be reused.

On Sep 28, 2015, at 4:44 PM, Ben Parees [email protected] wrote:

what happens when i clone a build created in this way? (oc start-build
--from-build=previous_build)?

what happens when i have an image change trigger associated with a build
like this and it gets triggered?

—
Reply to this email directly or view it on GitHub
#4819 (comment).

@bparees

bparees commented Sep 30, 2015

Copy link
Copy Markdown
Contributor

why wouldn't we do this with an intermediary fileserver that can run as infrastructure?

that would also allow users to host artifacts on their own fileservers and reference them from a build.

push flow would be:

  1. push uploads to internal fileserver (or user uploads to external fileserver)
  2. build is triggered (by push or by user)
  3. build steps pull from fileserver (instead of/in addition to a git clone)

this would allow build triggers to work as long as the artifact was uploaded at some point and allow for rebuilds.

challenges are quota'ing the fileserver and tracking versions of uploaded artifacts so a rebuild gets the same version of the artifact, not a new one that has been uploaded since the build last ran, if those are deemed important.

@smarterclayton

Copy link
Copy Markdown
Contributor Author

I don't know that we want to do binary deploys to running pods in general.
Our model for binary deploy is a docker image.

Having a sidecar build is interesting, but it's not clear to me it's easier
in the long run. I do think we should be able to launch a build and
provide a binary separately... but the mindset that the input to a docker
builder comes from stdin aligns with other behaviors in the system (for
instance, the fact that it is the UNIX Way, and that it leverages the
innate flow of the core container start).

I don't like having two process when one works normally.

On Sep 29, 2015, at 3:50 PM, Cesar Wong [email protected] wrote:

@smarterclayton https://github.com/smarterclayton do we need to have the
build be the main process of the build pod? Could we not start a build
watcher process and then simply exec with stdin into the pod once that's
running? That wouldn't require any changes to exec. Same could apply to a
running pod that we want to do a binary deploy to.

—
Reply to this email directly or view it on GitHub
#4819 (comment).

@smarterclayton

Copy link
Copy Markdown
Contributor Author

On Sep 30, 2015, at 12:00 PM, Ben Parees [email protected] wrote:

why wouldn't we do this with an intermediary fileserver that can run as
infrastructure?

That's a pull model. That's a URL source type with auth. Different
workflow.

that would also allow users to host artifacts on their own fileservers and
reference them from a build.

push flow would be:

  1. push uploads to internal fileserver (or user uploads to external
    fileserver)
  2. build is triggered (by push or by user)
  3. build steps pull from fileserver (instead of/in addition to a git clone)

this would allow build triggers to work as long as the artifact was
uploaded at some point and allow for rebuilds.

challenges are quota'ing the fileserver and tracking versions of uploaded
artifacts so a rebuild gets the same version of the artifact, not a new one
that has been uploaded since the build last ran, if those are deemed
important.

And having an HA file server. It's basically a next step down the road -
honestly, a maven/nexus/s3 style trigger type is logical and reasonable.
But if you support binary push you tackle the short term need, then you add
a URL type, then you can convert binary push to URL type on the fly. But
URL type is still a pull model and has problems in some flows.

—
Reply to this email directly or view it on GitHub
#4819 (comment).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There is a subtle difference between doing this vs receiving straight from time.After in the select, mind documenting this so none will carelessly move it in the future?

@smarterclayton
smarterclayton force-pushed the add_binary_build branch 4 times, most recently from 93a3890 to 39b8cb8 Compare October 5, 2015 02:49
@smarterclayton

Copy link
Copy Markdown
Contributor Author

@csrwng or @mfojtik can you review the changes in the STI commit? This avoids a fair amount of duplicate work, and for STI builds on OpenShift setup will be identical between Docker and STI inputs. Still some changes needed, like allowing source info to be passed in on the build vs. having to pull it from Git.

@smarterclayton

Copy link
Copy Markdown
Contributor Author

[test]

@openshift-bot

Copy link
Copy Markdown
Contributor

@bparees

bparees commented Oct 5, 2015

Copy link
Copy Markdown
Contributor

can you submit it as an s2i PR so we can just merge it there and do a bump here?

@mfojtik

mfojtik commented Oct 5, 2015

Copy link
Copy Markdown
Contributor

+1 to what @bparees is saying

@smarterclayton

Copy link
Copy Markdown
Contributor Author

The s2i changes aren't complete - I'd prefer to have you guys review in context of how they're being used before I split the review discussion.

Comment thread pkg/client/buildconfigs.go Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

InstantiateBinary

@openshift-bot openshift-bot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Oct 23, 2015
@smarterclayton

Copy link
Copy Markdown
Contributor Author

[merge]

@openshift-bot

Copy link
Copy Markdown
Contributor

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/merge_pull_requests_origin/3764/) (Image: devenv-rhel7_2551)

@openshift-bot openshift-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 23, 2015
@smarterclayton

Copy link
Copy Markdown
Contributor Author

[test]

@smarterclayton
smarterclayton force-pushed the add_binary_build branch 2 times, most recently from 0df6cb3 to 89b256a Compare October 24, 2015 18:34
Binary builds are driven by a client launching a build and then
providing a binary input stream for the contents of the build. The build
should accept either a file or archive (tar, tar.gz, or zip) and use the
contents provided in place of normal source download.

The primary REST endpoint is `/buildconfigs/<name>/instantiatebinary`,
which creates a new build from a build config, accepts query parameters
to populate a BinaryBuildRequestOptions object, then on POST creates
the build, waits for it to be running, and attaches to STDIN and streams
the provided input stream to the user.

The start-build command is enhanced to support --from-dir, --from-file,
and --from-repo, which load local directories or files, set source info
(if available) onto the request, and then trigger the build by invoking
the REST endpoint.

The describers in the CLI have been enhanced to show info about binary
builds.
Read input from STDIN, extract an archive with bsdtar, and then
initiate the build. Avoid creating a temporary tar file in both
STI and Docker and instead stream directly from disk.
@openshift-bot

Copy link
Copy Markdown
Contributor

Evaluated for origin test up to 89b256a

@openshift-bot

Copy link
Copy Markdown
Contributor

Evaluated for origin merge up to 89b256a

openshift-bot pushed a commit that referenced this pull request Oct 24, 2015
@openshift-bot
openshift-bot merged commit 3eec4dd into openshift:master Oct 24, 2015
@smarterclayton

Copy link
Copy Markdown
Contributor Author

Going to push one more fix to context for (we apparently don't test it in
non extended path)

On Oct 24, 2015, at 5:22 PM, OpenShift Bot [email protected] wrote:

Merged #4819 #4819.

—
Reply to this email directly or view it on GitHub
#4819 (comment).

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants