-
Notifications
You must be signed in to change notification settings - Fork 244
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
Support autoBuild
and deployByDefault
on Image and Kubernetes/OpenShift components
#6654
Merged
openshift-merge-robot
merged 23 commits into
redhat-developer:main
from
rm3l:5694-implement-autobuild-and-deploybydefault
Apr 5, 2023
Merged
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
dddb2dc
Add sample Devfile with multiple autoBuild/deployByDefault combinations
rm3l d3a9420
Add helper function to update a given Devfile Command Group
rm3l 35a6e50
Add test cases for 'odo dev'
rm3l 125ff54
Add test cases for 'odo deploy'
rm3l 510c5db
Add test cases for 'odo build-images'
rm3l 344879a
Display the spinner when creating or updating Kubernetes resources
rm3l cbbd52a
Handle deployByDefault on K8s and OpenShift components
rm3l 399b42c
Add 'devfile.GetImageComponentsToPush' functions that returns the lis…
rm3l 669b6a8
Handle automatic image component creation for 'odo dev' on Kubernetes
rm3l b14213a
Handle automatic image component creation for 'odo dev' on Podman
rm3l 3058f5a
Handle automatic image and K8s/OpenShift component creation for 'odo …
rm3l 035e826
Bump Devfile library to the latest commit at this time (c1b23d2)
rm3l 0760872
Do not set default values when parsing a Devfile
rm3l 228c704
Add documentation in the Devfile reference page
rm3l 5ef6655
Revert "Display the spinner when creating or updating Kubernetes reso…
rm3l d027561
Avoid re-applying Image components multiple times
rm3l 2ad44e8
Move GetK8sAndOcComponentsToPush and GetImageComponentsToPush to libd…
rm3l bba3c88
fixup! Handle automatic image and K8s/OpenShift component creation fo…
rm3l f6887b5
fixup! Handle automatic image component creation for 'odo dev' on Podman
rm3l 71e0ba2
fixup! Avoid re-applying Image components multiple times
rm3l 7a1f1a0
Apply suggestions from code review
rm3l 3673d01
fixup! Do not set default values when parsing a Devfile
rm3l dc0fe61
Fix devfile-deploy-functional-pods.yaml (used in 'odo logs' tests)
rm3l File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
390 changes: 390 additions & 0 deletions
390
tests/examples/source/devfiles/nodejs/devfile-autobuild-deploybydefault.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,390 @@ | ||
commands: | ||
- exec: | ||
commandLine: npm install | ||
component: runtime | ||
group: | ||
isDefault: true | ||
kind: build | ||
workingDir: ${PROJECT_SOURCE} | ||
id: build | ||
|
||
- exec: | ||
commandLine: npm run start | ||
component: runtime | ||
group: | ||
isDefault: true | ||
kind: run | ||
workingDir: ${PROJECT_SOURCE} | ||
id: start-app | ||
- exec: | ||
commandLine: npm run debug | ||
component: runtime | ||
group: | ||
isDefault: true | ||
kind: debug | ||
workingDir: ${PROJECT_SOURCE} | ||
id: start-app-debug | ||
|
||
- apply: | ||
component: autobuild-true-and-referenced | ||
id: image-autobuild-true-and-referenced | ||
- apply: | ||
component: autobuild-false-and-referenced | ||
id: image-autobuild-false-and-referenced | ||
- apply: | ||
component: autobuild-not-set-and-referenced | ||
id: image-autobuild-not-set-and-referenced | ||
|
||
- composite: | ||
commands: | ||
- image-autobuild-true-and-referenced | ||
- image-autobuild-false-and-referenced | ||
- image-autobuild-not-set-and-referenced | ||
- apply-k8s-deploybydefault-true-and-referenced | ||
- apply-ocp-deploybydefault-true-and-referenced | ||
- apply-k8s-deploybydefault-false-and-referenced | ||
- apply-ocp-deploybydefault-false-and-referenced | ||
- apply-k8s-deploybydefault-not-set-and-referenced | ||
- apply-ocp-deploybydefault-not-set-and-referenced | ||
- start-app | ||
group: | ||
isDefault: false | ||
kind: run | ||
id: run-with-referenced-components | ||
- composite: | ||
commands: | ||
- image-autobuild-true-and-referenced | ||
- image-autobuild-false-and-referenced | ||
- image-autobuild-not-set-and-referenced | ||
- apply-k8s-deploybydefault-true-and-referenced | ||
- apply-ocp-deploybydefault-true-and-referenced | ||
- apply-k8s-deploybydefault-false-and-referenced | ||
- apply-ocp-deploybydefault-false-and-referenced | ||
- apply-k8s-deploybydefault-not-set-and-referenced | ||
- apply-ocp-deploybydefault-not-set-and-referenced | ||
- start-app-debug | ||
group: | ||
isDefault: false | ||
kind: debug | ||
id: debug-with-referenced-components | ||
|
||
- composite: | ||
group: | ||
isDefault: true | ||
kind: deploy | ||
id: deploy | ||
|
||
- apply: | ||
component: k8s-deploybydefault-true-and-referenced | ||
id: apply-k8s-deploybydefault-true-and-referenced | ||
- apply: | ||
component: ocp-deploybydefault-true-and-referenced | ||
id: apply-ocp-deploybydefault-true-and-referenced | ||
- apply: | ||
component: k8s-deploybydefault-false-and-referenced | ||
id: apply-k8s-deploybydefault-false-and-referenced | ||
- apply: | ||
component: ocp-deploybydefault-false-and-referenced | ||
id: apply-ocp-deploybydefault-false-and-referenced | ||
- apply: | ||
component: k8s-deploybydefault-not-set-and-referenced | ||
id: apply-k8s-deploybydefault-not-set-and-referenced | ||
- apply: | ||
component: ocp-deploybydefault-not-set-and-referenced | ||
id: apply-ocp-deploybydefault-not-set-and-referenced | ||
|
||
- composite: | ||
commands: | ||
- image-autobuild-true-and-referenced | ||
- image-autobuild-false-and-referenced | ||
- image-autobuild-not-set-and-referenced | ||
- apply-k8s-deploybydefault-true-and-referenced | ||
- apply-ocp-deploybydefault-true-and-referenced | ||
- apply-k8s-deploybydefault-false-and-referenced | ||
- apply-ocp-deploybydefault-false-and-referenced | ||
- apply-k8s-deploybydefault-not-set-and-referenced | ||
- apply-ocp-deploybydefault-not-set-and-referenced | ||
group: | ||
isDefault: false | ||
kind: deploy | ||
id: deploy-with-referenced-components | ||
|
||
|
||
components: | ||
- container: | ||
command: [ 'tail' ] | ||
args: [ '-f', '/dev/null' ] | ||
endpoints: | ||
- name: "3000-tcp" | ||
targetPort: 3000 | ||
- name: "debug" | ||
targetPort: 5858 | ||
exposure: none | ||
env: | ||
- name: DEBUG_PORT_PROJECT | ||
value: "5858" | ||
image: registry.access.redhat.com/ubi8/nodejs-12:1-36 | ||
memoryLimit: 1024Mi | ||
mountSources: true | ||
name: runtime | ||
|
||
####################### | ||
# Kubernetes components | ||
####################### | ||
|
||
# deployByDefault true, referenced in apply command => automatically created on startup | ||
- kubernetes: | ||
deployByDefault: true | ||
inlined: | | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: k8s-deploybydefault-true-and-referenced | ||
spec: | ||
containers: | ||
- name: main | ||
image: busybox | ||
command: ["/bin/sh", "-ec", "while :; do echo '.'; sleep 5 ; done"] | ||
name: k8s-deploybydefault-true-and-referenced | ||
|
||
# deployByDefault true, not referenced in apply command => automatically created on startup | ||
- kubernetes: | ||
deployByDefault: true | ||
inlined: | | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: k8s-deploybydefault-true-and-not-referenced | ||
spec: | ||
containers: | ||
- name: main | ||
image: busybox | ||
command: ["/bin/sh", "-ec", "while :; do echo '.'; sleep 5 ; done"] | ||
name: k8s-deploybydefault-true-and-not-referenced | ||
|
||
# deployByDefault false, referenced in apply command => created when apply command is invoked | ||
- kubernetes: | ||
deployByDefault: false | ||
inlined: | | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: k8s-deploybydefault-false-and-referenced | ||
spec: | ||
containers: | ||
- name: main | ||
image: busybox | ||
command: ["/bin/sh", "-ec", "while :; do echo '.'; sleep 5 ; done"] | ||
name: k8s-deploybydefault-false-and-referenced | ||
|
||
# deployByDefault false, not referenced in apply command => never started ??? | ||
- kubernetes: | ||
deployByDefault: false | ||
inlined: | | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: k8s-deploybydefault-false-and-not-referenced | ||
spec: | ||
containers: | ||
- name: main | ||
image: busybox | ||
command: ["/bin/sh", "-ec", "while :; do echo '.'; sleep 5 ; done"] | ||
name: k8s-deploybydefault-false-and-not-referenced | ||
|
||
# deployByDefault not set, referenced in apply command => created when apply command is invoked | ||
- kubernetes: | ||
inlined: | | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: k8s-deploybydefault-not-set-and-referenced | ||
spec: | ||
containers: | ||
- name: main | ||
image: busybox | ||
command: ["/bin/sh", "-ec", "while :; do echo '.'; sleep 5 ; done"] | ||
name: k8s-deploybydefault-not-set-and-referenced | ||
|
||
# deployByDefault not set, not referenced in apply command => automatically created on startup | ||
- kubernetes: | ||
inlined: | | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: k8s-deploybydefault-not-set-and-not-referenced | ||
spec: | ||
containers: | ||
- name: main | ||
image: busybox | ||
command: ["/bin/sh", "-ec", "while :; do echo '.'; sleep 5 ; done"] | ||
name: k8s-deploybydefault-not-set-and-not-referenced | ||
|
||
####################### | ||
# OpenShift components | ||
####################### | ||
|
||
# deployByDefault true, referenced in apply command => automatically created on startup | ||
- openshift: | ||
deployByDefault: true | ||
inlined: | | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: ocp-deploybydefault-true-and-referenced | ||
spec: | ||
containers: | ||
- name: main | ||
image: busybox | ||
command: ["/bin/sh", "-ec", "while :; do echo '.'; sleep 5 ; done"] | ||
name: ocp-deploybydefault-true-and-referenced | ||
|
||
# deployByDefault true, not referenced in apply command => automatically created on startup | ||
- openshift: | ||
deployByDefault: true | ||
inlined: | | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: ocp-deploybydefault-true-and-not-referenced | ||
spec: | ||
containers: | ||
- name: main | ||
image: busybox | ||
command: ["/bin/sh", "-ec", "while :; do echo '.'; sleep 5 ; done"] | ||
name: ocp-deploybydefault-true-and-not-referenced | ||
|
||
# deployByDefault false, referenced in apply command => created when apply command is invoked | ||
- openshift: | ||
deployByDefault: false | ||
inlined: | | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: ocp-deploybydefault-false-and-referenced | ||
spec: | ||
containers: | ||
- name: main | ||
image: busybox | ||
command: ["/bin/sh", "-ec", "while :; do echo '.'; sleep 5 ; done"] | ||
name: ocp-deploybydefault-false-and-referenced | ||
|
||
# deployByDefault false, not referenced in apply command => never started ??? | ||
- openshift: | ||
deployByDefault: false | ||
inlined: | | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: ocp-deploybydefault-false-and-not-referenced | ||
spec: | ||
containers: | ||
- name: main | ||
image: busybox | ||
command: ["/bin/sh", "-ec", "while :; do echo '.'; sleep 5 ; done"] | ||
name: ocp-deploybydefault-false-and-not-referenced | ||
|
||
# deployByDefault not set, referenced in apply command => created when apply command is invoked | ||
- openshift: | ||
inlined: | | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: ocp-deploybydefault-not-set-and-referenced | ||
spec: | ||
containers: | ||
- name: main | ||
image: busybox | ||
command: ["/bin/sh", "-ec", "while :; do echo '.'; sleep 5 ; done"] | ||
name: ocp-deploybydefault-not-set-and-referenced | ||
|
||
# deployByDefault not set, not referenced in apply command => automatically created on startup | ||
- openshift: | ||
inlined: | | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: ocp-deploybydefault-not-set-and-not-referenced | ||
spec: | ||
containers: | ||
- name: main | ||
image: busybox | ||
command: ["/bin/sh", "-ec", "while :; do echo '.'; sleep 5 ; done"] | ||
name: ocp-deploybydefault-not-set-and-not-referenced | ||
|
||
####################### | ||
# Image components | ||
####################### | ||
|
||
# autoBuild true, referenced in apply command => automatically created on startup | ||
- image: | ||
autoBuild: true | ||
dockerfile: | ||
buildContext: . | ||
uri: Dockerfile | ||
imageName: "{{ CONTAINER_IMAGE_REPO }}:autobuild-true-and-referenced" | ||
name: autobuild-true-and-referenced | ||
|
||
# autoBuild true, not referenced in apply command => automatically created on startup | ||
- image: | ||
autoBuild: true | ||
dockerfile: | ||
buildContext: . | ||
uri: Dockerfile | ||
imageName: "{{ CONTAINER_IMAGE_REPO }}:autobuild-true-and-not-referenced" | ||
name: autobuild-true-and-not-referenced | ||
|
||
# autoBuild false, referenced in apply command => created when apply command is invoked | ||
- image: | ||
autoBuild: false | ||
dockerfile: | ||
buildContext: . | ||
uri: Dockerfile | ||
imageName: "{{ CONTAINER_IMAGE_REPO }}:autobuild-false-and-referenced" | ||
name: autobuild-false-and-referenced | ||
|
||
# autoBuild false, not referenced in apply command => never started ??? | ||
- image: | ||
autoBuild: false | ||
dockerfile: | ||
buildContext: . | ||
uri: Dockerfile | ||
imageName: "{{ CONTAINER_IMAGE_REPO }}:autobuild-false-and-not-referenced" | ||
name: autobuild-false-and-not-referenced | ||
|
||
# autoBuild not set, referenced in apply command => created when apply command is invoked | ||
- image: | ||
dockerfile: | ||
buildContext: . | ||
uri: Dockerfile | ||
imageName: "{{ CONTAINER_IMAGE_REPO }}:autobuild-not-set-and-referenced" | ||
name: autobuild-not-set-and-referenced | ||
|
||
# autoBuild not set, not referenced in apply command => automatically created on startup | ||
- image: | ||
dockerfile: | ||
buildContext: . | ||
uri: Dockerfile | ||
imageName: "{{ CONTAINER_IMAGE_REPO }}:autobuild-not-set-and-not-referenced" | ||
name: autobuild-not-set-and-not-referenced | ||
|
||
metadata: | ||
description: Stack with Node.js 14 | ||
displayName: Node.js Runtime | ||
icon: https://nodejs.org/static/images/logos/nodejs-new-pantone-black.svg | ||
language: javascript | ||
name: my-node-app | ||
projectType: nodejs | ||
tags: | ||
- NodeJS | ||
- Express | ||
- ubi8 | ||
version: 1.0.0 | ||
schemaVersion: 2.2.0 | ||
starterProjects: | ||
- git: | ||
remotes: | ||
origin: https://github.com/odo-devfiles/nodejs-ex.git | ||
name: nodejs-starter | ||
variables: | ||
CONTAINER_IMAGE_REPO: localhost:5000/odo-dev/node |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
nit:
I think command ID could simply be
image-autobuild-true
because if a command is defined for a component, it most definitely is referenced.Same for other commands.
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.
Done in
65812b8
(#6720)