Skip to content
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

Deploy Command for OCP #3478

Closed
wants to merge 63 commits into from
Closed
Show file tree
Hide file tree
Changes from 39 commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
90191a4
WIP: Add simple poc build command
EnriqueL8 May 22, 2020
efab329
POC Build
EnriqueL8 Jun 4, 2020
ddf14ab
WIP: Add syncfiles poc for build
EnriqueL8 Jun 8, 2020
037012d
Add ServiceAccount env
EnriqueL8 Jun 8, 2020
78f28ae
Clean up code
EnriqueL8 Jun 9, 2020
ea4a573
Add defer for delete
EnriqueL8 Jun 10, 2020
11dec2b
First pass downloading Dockerfile specified in devfile
upLukeWeston Jun 11, 2020
2bc2e4c
Merge branch 'deploy_command' of https://github.com/EnriqueL8/odo int…
upLukeWeston Jun 11, 2020
630ae4a
Fix compilation issue
EnriqueL8 Jun 11, 2020
4102af3
Moved Dockerfile download to .odo to avoid overwriting users one in t…
upLukeWeston Jun 11, 2020
630b9dd
Merge branch 'deploy_command' into parse_dockerfile
upLukeWeston Jun 11, 2020
a81f13f
Updates for initial deploy steps
groeges Jun 10, 2020
603b722
Tidy up following PR comments
groeges Jun 11, 2020
8733e06
Incorporate changes to determine manifest from devfile.yaml
groeges Jun 12, 2020
500000b
Updates for initial deploy steps
EnriqueL8 Jun 12, 2020
0041f07
Fixing seg fault and defer error
EnriqueL8 Jun 15, 2020
958932d
User validation and Dockerfile in memory support
upLukeWeston Jun 25, 2020
12658f2
Add delete deploy (#7)
EnriqueL8 Jun 25, 2020
7129292
Include additional parts of deploy manifest step (#4)
groeges Jun 26, 2020
1e2c221
Build config (#8)
EnriqueL8 Jun 26, 2020
1d1423b
updated manifest file and added tests (#10)
Jun 30, 2020
32beaf9
Resolve PR comments and change to use alpha.build-dockerfile and (#11)
groeges Jun 30, 2020
fe7dbaa
Add some tests for manifest deploy part of `odo deploy` command (#13)
groeges Jul 1, 2020
4f53442
Remove --deployOnly option (#14)
groeges Jul 1, 2020
1008511
General clean up (#12)
EnriqueL8 Jul 1, 2020
9d82133
Merge remote-tracking branch 'origin/master' into deploy_command
EnriqueL8 Jul 2, 2020
3cc73db
Fix issues in merge conflict
EnriqueL8 Jul 2, 2020
8291abb
Fix tests following restructure of command messages (#16)
groeges Jul 2, 2020
431717c
Fix issues in merge conflict
EnriqueL8 Jul 2, 2020
6790683
Fix dockerfile test
EnriqueL8 Jul 2, 2020
69a3c58
Reduced permissions on file created (#15)
upLukeWeston Jul 2, 2020
586caaa
Fix deploy delete tests
EnriqueL8 Jul 6, 2020
84cc342
Delete duplicate line in test
EnriqueL8 Jul 6, 2020
2f548b7
Removing warning check in test
EnriqueL8 Jul 6, 2020
bb21b19
Remove output variable from test
EnriqueL8 Jul 6, 2020
511a0a4
Allow use of file:// in devfile.yaml for manifest and dockerfile (#20)
groeges Jul 9, 2020
58ac5b7
Handle CTRL-C during Build (#19)
upLukeWeston Jul 13, 2020
1ae5ece
Add check for valid URL/PORT in env.yaml if PORT defined in manifest …
groeges Jul 16, 2020
9d9cb93
Add tag format to flag help text.
EnriqueL8 Jul 20, 2020
c99828e
Update method of determining the application URL (#18)
groeges Jul 21, 2020
f4630b1
Update to use text/template for template variable substitution (#23)
groeges Jul 22, 2020
266151b
Update error message for test
EnriqueL8 Jul 22, 2020
d0913d9
Requested Changes
EnriqueL8 Jul 22, 2020
d857988
Merge remote-tracking branch 'origin/master' into deploy_command
EnriqueL8 Jul 22, 2020
0c88e9d
Fix issues with merge conflicts
EnriqueL8 Jul 22, 2020
febd952
Update devfile schema (#24)
groeges Jul 23, 2020
33379af
Support odo deploy without tag (#22)
upLukeWeston Jul 27, 2020
32d6fff
Add missing packages (#25)
groeges Jul 27, 2020
7ffd1bd
Merge remote-tracking branch 'origin/master' into deploy_command
EnriqueL8 Jul 28, 2020
150c6ab
Add deploy tests to travis
EnriqueL8 Jul 28, 2020
554045c
Change url log to warning
EnriqueL8 Jul 28, 2020
6e4e53a
Fix issues with deploy tests which check for imagestreams (#26)
groeges Jul 28, 2020
b584397
Fix linting errors (#27)
EnriqueL8 Jul 30, 2020
89d7531
Merge branch 'master' into deploy_command
EnriqueL8 Aug 3, 2020
b3c3a36
Fix merge conflict formating
EnriqueL8 Aug 3, 2020
defd971
Merge branch 'master' into deploy_command
EnriqueL8 Aug 10, 2020
5c4c196
Fix fmt merge conflicts
EnriqueL8 Aug 10, 2020
164e921
Trying svc.cluster.local as registry url
EnriqueL8 Aug 24, 2020
db0f4c9
Dynamically get registry URL
EnriqueL8 Aug 27, 2020
9c30cbc
Merge remote-tracking branch 'origin/master' into deploy_command
EnriqueL8 Aug 27, 2020
bfbb7dd
Fix DeployParameters Comment
EnriqueL8 Sep 11, 2020
ca0dd6c
Merge remote-tracking branch 'origin/master' into deploy_command
EnriqueL8 Sep 11, 2020
51a5d36
Fix linting errors
EnriqueL8 Sep 11, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,16 @@ test-cmd-devfile-create:
test-cmd-devfile-push:
ginkgo $(GINKGO_FLAGS) -focus="odo devfile push command tests" tests/integration/devfile/

# Run odo deploy devfile command tests
.PHONY: test-cmd-devfile-deploy
test-cmd-devfile-deploy:
ginkgo $(GINKGO_FLAGS) -focus="odo devfile deploy command tests" tests/integration/devfile/

# Run odo deploy delete devfile command tests
.PHONY: test-cmd-devfile-deploy-delete
test-cmd-devfile-deploy-delete:
ginkgo $(GINKGO_FLAGS) -focus="odo devfile deploy delete command tests" tests/integration/devfile/

# Run odo devfile watch command tests
.PHONY: test-cmd-devfile-watch
test-cmd-devfile-watch:
Expand Down
3 changes: 3 additions & 0 deletions pkg/devfile/adapters/common/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@ package common
// ComponentAdapter defines the functions that platform-specific adapters must implement
type ComponentAdapter interface {
Push(parameters PushParameters) error
Build(parameters BuildParameters) error
Deploy(parameters DeployParameters) error
DoesComponentExist(cmpName string) bool
Delete(labels map[string]string) error
DeployDelete(manifest []byte) error
}

// StorageAdapter defines the storage functions that platform-specific adapters must implement
Expand Down
17 changes: 17 additions & 0 deletions pkg/devfile/adapters/common/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,23 @@ type Storage struct {
Volume DevfileVolume
}

// BuildParameters is a struct containing the parameters to be used when building the image for a devfile component
type BuildParameters struct {
Path string // Path refers to the parent folder containing the source code to push up to a component
DockerfileBytes []byte // DockerfileBytes is the contents of the project Dockerfile in bytes
EnvSpecificInfo envinfo.EnvSpecificInfo // EnvSpecificInfo contains infomation of env.yaml file
Tag string // Tag refers to the image tag of the image being built
IgnoredFiles []string // IgnoredFiles is the list of files to not push up to a component
}

// DeployParameters is a struct containing the parameters to be used when building the image for a devfile component
EnriqueL8 marked this conversation as resolved.
Show resolved Hide resolved
type DeployParameters struct {
EnvSpecificInfo envinfo.EnvSpecificInfo // EnvSpecificInfo contains infomation of env.yaml file
Tag string // Tag refers to the image tag of the image being built
ManifestSource []byte // Source of the manifest file
DeploymentPort int // Port to be used in deployment manifest
}

// PushParameters is a struct containing the parameters to be used when pushing to a devfile component
type PushParameters struct {
Path string // Path refers to the parent folder containing the source code to push up to a component
Expand Down
12 changes: 12 additions & 0 deletions pkg/devfile/adapters/docker/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,18 @@ func (d Adapter) Push(parameters common.PushParameters) error {
return nil
}

func (k Adapter) Build(parameters common.BuildParameters) error {
return errors.New("Deploy command not supported when building image using pushTarget=Docker")
}

func (k Adapter) Deploy(parameters common.DeployParameters) error {
return errors.New("Deploy command not supported when using pushTarget=Docker")
}

func (k Adapter) DeployDelete(manifest []byte) error {
return errors.New("Deploy delete command not supported when using pushTarget=Docker")
}

// DoesComponentExist returns true if a component with the specified name exists
func (d Adapter) DoesComponentExist(cmpName string) bool {
return d.componentAdapter.DoesComponentExist(cmpName)
Expand Down
6 changes: 6 additions & 0 deletions pkg/devfile/adapters/docker/component/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ type Adapter struct {
machineEventLogger machineoutput.MachineEventLoggingClient
}

func (a Adapter) Build(parameters common.BuildParameters) (err error) { return nil }

func (a Adapter) Deploy(parameters common.DeployParameters) (err error) { return nil }

func (a Adapter) DeployDelete(manifest []byte) (err error) { return nil }

// Push updates the component if a matching component exists or creates one if it doesn't exist
func (a Adapter) Push(parameters common.PushParameters) (err error) {
componentExists, err := utils.ComponentExists(a.Client, a.Devfile.Data, a.ComponentName)
Expand Down
14 changes: 14 additions & 0 deletions pkg/devfile/adapters/interface.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package adapters

import (
"github.com/openshift/odo/pkg/devfile/adapters/common"
)

Choose a reason for hiding this comment

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

Is this interface actually used?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch! Not needed

type PlatformAdapter interface {
Push(parameters common.PushParameters) error
Build(parameters common.BuildParameters) error
Deploy(parameters common.DeployParameters) error
DoesComponentExist(cmpName string) bool
Delete(labels map[string]string) error
DeployDelete(manifest []byte) error
}
34 changes: 33 additions & 1 deletion pkg/devfile/adapters/kubernetes/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,39 @@ func (k Adapter) Push(parameters common.PushParameters) error {
return nil
}

// DoesComponentExist returns true if a component with the specified name exists
// Build creates Kubernetes resources to build an image for the component
func (k Adapter) Build(parameters common.BuildParameters) error {

err := k.componentAdapter.Build(parameters)
if err != nil {
return errors.Wrap(err, "Failed to build image for the component")
}

return nil
}

// Build creates Kubernetes resources to build an image for the component
func (k Adapter) Deploy(parameters common.DeployParameters) error {

err := k.componentAdapter.Deploy(parameters)
if err != nil {
return errors.Wrap(err, "Failed to deploy the application")
}

return nil
}

// Build creates Kubernetes resources to build an image for the component
func (k Adapter) DeployDelete(manifest []byte) error {

err := k.componentAdapter.DeployDelete(manifest)
if err != nil {
return errors.Wrap(err, "Failed to delete the deployed application")
}

return nil
}

func (k Adapter) DoesComponentExist(cmpName string) bool {
return k.componentAdapter.DoesComponentExist(cmpName)
}
Expand Down
Loading