{"action":"created","issue":{"url":"https://api.github.com/repos/openshift/source-to-image/issues/505","repository_url":"https://api.github.com/repos/openshift/source-to-image","labels_url":"https://api.github.com/repos/openshift/source-to-image/issues/505/labels{/name}","comments_url":"https://api.github.com/repos/openshift/source-to-image/issues/505/comments","events_url":"https://api.github.com/repos/openshift/source-to-image/issues/505/events","html_url":"https://github.com/openshift/source-to-image/pull/505","id":155995258,"number":505,"title":"[WIP] Extended build","user":{"login":"php-coder","id":87088,"avatar_url":"https://avatars.githubusercontent.com/u/87088?v=3","gravatar_id":"","url":"https://api.github.com/users/php-coder","html_url":"https://github.com/php-coder","followers_url":"https://api.github.com/users/php-coder/followers","following_url":"https://api.github.com/users/php-coder/following{/other_user}","gists_url":"https://api.github.com/users/php-coder/gists{/gist_id}","starred_url":"https://api.github.com/users/php-coder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/php-coder/subscriptions","organizations_url":"https://api.github.com/users/php-coder/orgs","repos_url":"https://api.github.com/users/php-coder/repos","events_url":"https://api.github.com/users/php-coder/events{/privacy}","received_events_url":"https://api.github.com/users/php-coder/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/openshift/source-to-image/labels/needs-rebase","name":"needs-rebase","color":"e11d21"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":37,"created_at":"2016-05-20T15:55:43Z","updated_at":"2016-06-23T18:22:32Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/openshift/source-to-image/pulls/505","html_url":"https://github.com/openshift/source-to-image/pull/505","diff_url":"https://github.com/openshift/source-to-image/pull/505.diff","patch_url":"https://github.com/openshift/source-to-image/pull/505.patch"},"body":"This is a **working draft** for the extended build.\r\n\r\nWhen we're specifying the `--runtime-image` and `--runtime-artifact` options, s2i:\r\n- runs builder container and does a build as usual\r\n- commits builder container (only when it's also increment build)\r\n- downloads artifacts (that were specified by `--runtime-artifact`) from the builder container and places them to a directory\r\n- runs another container with runtime image\r\n- uploads directory with artifacts into `WORKDIR` of a runtime image\r\n- runs `assemble-runtime` script\r\n- commits container with runtime image\r\n\r\nExample:\r\n```console\r\n$ cat .s2i/bin/assemble \r\n#!/bin/bash\r\nset -eu\r\necho \"It works!\" >/tmp/i-am-runtime-artifact1.txt\r\nchmod 666 /tmp/i-am-runtime-artifact1.txt\r\necho \"It works!\" >/tmp/.i-am-runtime-artifact3.txt\r\nchmod 600 /tmp/.i-am-runtime-artifact3.txt\r\ncd /tmp\r\nln -s i-am-runtime-artifact1.txt i-am-runtime-artifact2\r\nprintf '#!/bin/bash\\necho \"I am $0!\"\\n' >/tmp/run-me\r\nchmod 755 /tmp/run-me\r\nmkdir -p /tmp/data-dir/2\r\ntouch /tmp/data-dir/1\r\ntouch /tmp/data-dir/2/3\r\n\r\n$ cat .s2i/bin/assemble-runtime \r\n#!/bin/bash\r\nset -eu\r\necho \"I'm assemble-runtime\"\r\ntouch /tmp/assemble-runtime-done\r\n\r\n$ cat .s2i/bin/run \r\n#!/bin/bash\r\nset -eu\r\n/opt/jboss/run-me\r\n\r\n$ s2i build . openshift/wildfly-100-centos7 my-app --runtime-image jboss/base-jdk:8 --copy --assemble-user=1000 -a /tmp/i-am-runtime-artifact1.txt:app -a /tmp/i-am-runtime-artifact2:app -a /tmp/.i-warning: Image 61171b9324f6b76c3157efc7ffa8f7585913cebfe499634da75aa54ece2ed055 does not contain a value for the io.openshift.s2i.scripts-url label\r\nI0615 10:00:29.940748 00774 install.go:251] Using \"assemble\" installed from \"<source-dir>/.s2i/bin/assemble\"\r\nI0615 10:00:29.942639 00774 install.go:251] Using \"run\" installed from \"<source-dir>/.s2i/bin/run\"\r\nI0615 10:00:29.943062 00774 install.go:251] Using \"save-artifacts\" installed from \"image:///usr/libexec/s2i/save-artifacts\"\r\nI0615 10:00:29.943132 00774 install.go:251] Using \"assemble-runtime\" installed from \"<source-dir>/.s2i/bin/assemble-runtime\"\r\nI0615 10:00:29.943849 00774 environment.go:60] Setting 1 environment variables provided by environment file in sources\r\nI0615 10:00:33.626899 00774 postexecutorstep.go:346] [runtime image stdout] I'm assemble-runtime\r\n\r\n$ docker images | head -2\r\nREPOSITORY                                           TAG                 IMAGE ID            CREATED             VIRTUAL SIZE\r\nmy-app                                               latest              6ee5b5f789a7        10 seconds ago      464 MB\r\n\r\n$ docker run my-app\r\nI am /opt/jboss/run-me!\r\n\r\n$ docker run my-app find -ls\r\n16786700    0 drwxr-xr-x   4 jboss    jboss         114 Jun  9 16:32 .\r\n16826729    0 drwxr-xr-x   2 root     root          105 Jun  9 16:32 ./app\r\n16826730    4 -rw-r--r--   1 root     root           10 Jun  9 16:32 ./app/.i-am-runtime-artifact3.txt\r\n16826731    4 -rw-r--r--   1 root     root           10 Jun  9 16:32 ./app/i-am-runtime-artifact1.txt\r\n16826732    0 lrwxrwxrwx   1 root     root           26 Jun  9 16:32 ./app/i-am-runtime-artifact2 -> i-am-runtime-artifact1.txt\r\n33577783    0 drwxr-xr-x   3 root     root           24 Jun  9 16:32 ./data-dir\r\n33577784    0 -rw-r--r--   1 root     root            0 Jun  9 16:32 ./data-dir/1\r\n50342331    0 drwxr-xr-x   2 root     root           15 Jun  9 16:32 ./data-dir/2\r\n50342332    0 -rw-r--r--   1 root     root            0 Jun  9 16:32 ./data-dir/2/3\r\n16826733    4 -rwxr-xr-x   1 root     root           38 Jun  9 16:32 ./run\r\n16826734    4 -rwxr-xr-x   1 root     root           28 Jun  9 16:32 ./run-me\r\n\r\n$ docker run my-app ls -l /tmp/assemble-runtime-done\r\n-rw-r--r--. 1 root root 0 Jun 15 10:00 /tmp/assemble-runtime-done\r\n\r\n$ docker inspect my-app\r\n...\r\n    \"Config\": {\r\n        \"Hostname\": \"\",\r\n        \"Domainname\": \"\",\r\n        \"User\": \"jboss\",\r\n        \"AttachStdin\": false,\r\n        \"AttachStdout\": false,\r\n        \"AttachStderr\": false,\r\n        \"Tty\": false,\r\n        \"OpenStdin\": false,\r\n        \"StdinOnce\": false,\r\n        \"Env\": [\r\n            \"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\",\r\n            \"JAVA_HOME=/usr/lib/jvm/java\"\r\n        ],\r\n        \"Cmd\": [\r\n            \"/opt/jboss/run\"\r\n        ],\r\n        \"Image\": \"\",\r\n        \"Volumes\": null,\r\n        \"WorkingDir\": \"/opt/jboss\",\r\n        \"Entrypoint\": null,\r\n        \"OnBuild\": null,\r\n        \"Labels\": {\r\n            \"build-date\": \"2016-03-31\",\r\n            \"io.k8s.display-name\": \"my-app\",\r\n            \"io.openshift.s2i.build.image\": \"openshift/wildfly-100-centos7\",\r\n            \"io.openshift.s2i.build.source-location\": \"/data/src/github.com/openshift/source-to-image/mystamps\",\r\n            \"license\": \"GPLv2\",\r\n            \"name\": \"CentOS Base Image\",\r\n            \"vendor\": \"CentOS\"\r\n        }\r\n    },\r\n...\r\n```\r\n\r\nTrello card: https://trello.com/c/MWUAjl6k/237-13-extended-builds-separate-mvn-vs-jboss-evg\r\n\r\nPTAL @bparees @mfojtik \r\nCC @PI-Victor @rhcarvalho \r\n\r\nTODO:\r\n- [x] add unit tests\r\n- [ ] add integration tests\r\n- [ ] document (`docs/cli.md`: mention new options, `README.md: describe mechanics)\r\n- [ ] add documentation (describe mechanics, empty files with build secrets are gone, re-use auth for pulling the image, same env as for builder)\r\n"},"comment":{"url":"https://api.github.com/repos/openshift/source-to-image/issues/comments/228139270","html_url":"https://github.com/openshift/source-to-image/pull/505#issuecomment-228139270","issue_url":"https://api.github.com/repos/openshift/source-to-image/issues/505","id":228139270,"user":{"login":"bparees","id":4974046,"avatar_url":"https://avatars.githubusercontent.com/u/4974046?v=3","gravatar_id":"","url":"https://api.github.com/users/bparees","html_url":"https://github.com/bparees","followers_url":"https://api.github.com/users/bparees/followers","following_url":"https://api.github.com/users/bparees/following{/other_user}","gists_url":"https://api.github.com/users/bparees/gists{/gist_id}","starred_url":"https://api.github.com/users/bparees/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bparees/subscriptions","organizations_url":"https://api.github.com/users/bparees/orgs","repos_url":"https://api.github.com/users/bparees/repos","events_url":"https://api.github.com/users/bparees/events{/privacy}","received_events_url":"https://api.github.com/users/bparees/received_events","type":"User","site_admin":false},"created_at":"2016-06-23T18:22:32Z","updated_at":"2016-06-23T18:22:32Z","body":"> @bparees Are you agree on name of the label io.openshift.s2i.assemble-required-files? It should be on a runtime image because these files required by the assemble-runtime script that is also can be embedded into a runtime image. Also we can specify multiple files by using ; as a separator: /tmp/i-am-runtime-artifact1.txt:app;/tmp/run-me;/tmp/data-dir:.\r\n\r\n@php-coder so that label would take the place of needing to define the from/to files in the buildconfig?  but if you define them in the buildconfig (or in an s2i argument) it would override the value in this label?  I think i'd prefer \"assemble-input-files\".  Required seems like too strong a statement.\r\n\r\n> @bparees Looks like, when we're using incremental build and we're specifying runtime image, we need to provide 2 tags: one for builder image and another one for a resulted image. Earlier we could use just one tag, because resulted image was based on a builder image, but from now we can't do it because it will break next incremental build then. Do you agree? Or I'm missing something?\r\n\r\nI think you're correct.  If you want to be able to do an incremental flow, you need to tag the builder image output separately.  So we'd want an optional s2i flag which would be something like --builder-image-tag and we can tag the builder with that when building, and use that tag as the previous image when doing an incremental build.\r\n\r\nI'm not overly concerned with supporting that in openshift, at least as a first pass, though.  but eventually we'll probably need the ability to let openshift buildconfigs also specify the \"builder image tag\" to push the builder image to.\r\n"}}
{"actor":{"display_login":"bparees"}}