Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.

Add support to perform build in "odo deploy" using S2I strategy#3832

Closed
Shraddhak22 wants to merge 99 commits into
redhat-developer:masterfrom
rhd-gitops-example:add-s2i-to-odo-deploy
Closed

Add support to perform build in "odo deploy" using S2I strategy#3832
Shraddhak22 wants to merge 99 commits into
redhat-developer:masterfrom
rhd-gitops-example:add-s2i-to-odo-deploy

Conversation

@Shraddhak22

@Shraddhak22 Shraddhak22 commented Aug 25, 2020

Copy link
Copy Markdown

What type of PR is this?

/kind feature

What does does this PR do / why we need it:
This PR extends current "odo deploy" implementation by allowing build using S2I build strategy

  • Adds support for performing S2I build in "odo deploy", and pushing images to either internal or external registry.

NOTE: This PR builds on top of work contained in #3478 and #3751, and must only be merged after #3478 and #3751 has been merged

Which issue(s) this PR fixes:

Fixes #3846

PR acceptance criteria:

  • Unit test

How to test changes / Special notes to the reviewer:

  • create a new directory, cd into it and run odo create nodejs --starter=nodejs-starter
  • run odo url create
  • replace created devfile with the following sample :
schemaVersion: 2.1.0
metadata:
  name: nodejs
  version: 1.0.0
  alpha.build-dockerfile: "https://raw.githubusercontent.com/odo-devfiles/registry/master/devfiles/nodejs/build/Dockerfile"
  alpha.deployment-manifest: "https://raw.githubusercontent.com/odo-devfiles/registry/master/devfiles/nodejs/deploy/deployment-manifest.yaml"
projects:
  - name: nodejs-starter
    git:
      location: "https://github.com/odo-devfiles/nodejs-ex.git"
buildGuidances:
  - s2i:
      name: s2i-build
      builderImageNamespace: "openshift"
      builderImageStreamTag: "nodejs:12"
      scriptLocation: "https://raw.githubusercontent.com/Shraddhak22/s2i-scripts/master/s2i/bin"
      incrementalBuild: true
components:
  - container:
      name: runtime
      image: registry.access.redhat.com/ubi8/nodejs-12:1-45
      memoryLimit: 1024Mi
      mountSources: true
      sourceMapping: /project
      endpoints:
        - name: http-3000
          targetPort: 3000
commands:
  - exec:
      id: install
      component: runtime
      commandLine: npm install
      workingDir: /project
      group:
        kind: build
        isDefault: true
  - exec:
      id: run
      component: runtime
      commandLine: npm start
      workingDir: /project
      group:
        kind: run
        isDefault: true
  - exec:
      id: debug
      component: runtime
      commandLine: npm run debug
      workingDir: /project
      group:
        kind: debug
        isDefault: true
  - exec:
      id: test
      component: runtime
      commandLine: npm test
      workingDir: /project
      group:
        kind: test
        isDefault: true

Note: scriptLocation and incrementalBuild are optional parameters for S2I buildGuidance

  • run odo deploy --tag=<imageTag>

NOTE: Please supply complete destination under --tag
( for ex: image-registry.openshift-image-registry.svc:5000/namespace/imagestream or docker.io/username/repository-name)

NOTE: (Relevant to external registry push only) if --dockerconfigjson is not specified, config.json is picked up from ~/.docker. Please ensure the default config.json file contains a valid auth token. External registry push is currently only configured for Dockerhub

NOTE You can pass multiple build guidance in devfile, the first one from list will be picked up to decide build strategy, e.g in below scenario dockerfile guidance will have priority over s2i (Specific to "odo deploy").

buildGuidances:
    - dockerfile:
        name: dockerfile-build
        dockerfileLocation: "https://raw.githubusercontent.com/wtam2018/test/master/nodejs-dockerfiile"
        rootless: true
    - s2i:
        name: s2i-build
        builderImageNamespace: "openshift"
        builderImageStreamTag: "nodejs:12"
        scriptLocation: "https://raw.githubusercontent.com/Shraddhak22/s2i-scripts/master/s2i/bin"
        incrementalBuild: true

EnriqueL8 and others added 30 commits June 4, 2020 14:39
Signed-off-by: Steven Groeger <groeges@uk.ibm.com>
Signed-off-by: Steven Groeger <groeges@uk.ibm.com>
Signed-off-by: Steven Groeger <groeges@uk.ibm.com>
 - Downloads Dockerfile into memory rather than onto the hosts machine
 - Validates if a Dockerfile is present in the project source, if one isn't specified by the devfile
 - Validates the contents of the Dockerfile (that there is a FROM on the first non-comment/non-whitespace line)
 - Validates the tag passed as an arg conforms to the correct character-set
 - Copies all project source files into the container rather than new/updated
 - Additional Testing
 - More appropriate error/warning messages
Co-authored-by: Cameron McWilliam <cam.mcwilliam@me.com>
* Add test List URL function

Signed-off-by: Steven Groeger <groeges@uk.ibm.com>

* Update logging within maifest deploy

Signed-off-by: Steven Groeger <groeges@uk.ibm.com>

* Add preliminary support for multiple manifest in single yaml

Signed-off-by: Steven Groeger <groeges@uk.ibm.com>

* Update service manifest with ClusterIP value before update.

Signed-off-by: Steven Groeger <groeges@uk.ibm.com>

* Merge deployDelete code and update to support multiple doc in yaml

Signed-off-by: Steven Groeger <groeges@uk.ibm.com>

* Fix source formatting

Signed-off-by: Steven Groeger <groeges@uk.ibm.com>

* Add some extra checks on waitManifestDeployComplete function

Signed-off-by: Steven Groeger <groeges@uk.ibm.com>
alpha.deployment-manifest


Signed-off-by: Steven Groeger <groeges@uk.ibm.com>
Signed-off-by: Steven Groeger <groeges@uk.ibm.com>
Signed-off-by: Steven Groeger <groeges@uk.ibm.com>
* Remove CommonPushOptions and do some clean up

* Move validation, add better user experience, remove devfile.yaml flag
Signed-off-by: Steven Groeger <groeges@uk.ibm.com>
Jaideep Rao and others added 21 commits July 30, 2020 13:02
* Make 2.1.0 schema = 2.0.0 schmea + dockerfile component
Kaniko image build strategy to use initContainer to remotely copy source to builder pod.
)

* runKaniko() function redirects builder pod logs to stdout, wait for completion, and return error/nil
* Check for internal vs external image registry from the image tag's host.  Create dockerconfig secret if it is external registry.
…istries (#163)

* Kaniko build strategy to support pushing images to internal registry
Add unit tests to Kaniko build in "odo deploy"
…ternal registries (#172)

* Add s2i build strategy support in odo deploy.
@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. Required by Prow. label Aug 25, 2020
@openshift-ci-robot

Copy link
Copy Markdown
Collaborator

@Shraddhak22: PR needs rebase.

Details

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.

@openshift-ci-robot

Copy link
Copy Markdown
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To complete the pull request process, please assign kadel
You can assign the PR to them by writing /assign @kadel in a comment when ready.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. Required by Prow. label Aug 25, 2020
@openshift-ci-robot

Copy link
Copy Markdown
Collaborator

Hi @Shraddhak22. Thanks for your PR.

I'm waiting for a openshift member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

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.

@girishramnani

Copy link
Copy Markdown
Contributor

Closing this PR as it has diverged

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

Labels

needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. Required by Prow. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. Required by Prow.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support non dockerfile build for "odo deploy"

8 participants