-
Notifications
You must be signed in to change notification settings - Fork 13
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
Possibility to fetch deploy a service from git #190
Conversation
Codecov Report
@@ Coverage Diff @@
## dev #190 +/- ##
==========================================
- Coverage 74.3% 63.96% -10.35%
==========================================
Files 58 69 +11
Lines 1187 1515 +328
==========================================
+ Hits 882 969 +87
- Misses 234 473 +239
- Partials 71 73 +2
Continue to review full report at Codecov.
|
cmd/service/utils.go
Outdated
@@ -31,8 +35,32 @@ func handleError(err error) { | |||
} | |||
} | |||
|
|||
func gitClone(url string) (path string, err error) { | |||
tmpFile := "/tmp/mesg-templates" |
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.
This is very ugly to put the path in a root folder like this.
It's not even deleted at the end.
If you look at https://golang.org/pkg/io/ioutil/#TempDir, it says If dir is the empty string, TempDir uses the default directory for temporary files
Eg:
dir, err := ioutil.TempDir("", "example")
if err != nil {
log.Fatal(err)
}
defer os.RemoveAll(dir) // clean up
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.
This PR seems to not be finished..
@antho1404 are you sure you push all your local commits?
cmd/service/utils.go
Outdated
if err != nil { | ||
return | ||
} | ||
path, err = ioutil.TempDir(tmpFile, string(time.Now().UnixNano())) |
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.
On my computer path
is like: /tmp/mesg-templates/�094045028
There is a encoding error. You should use
strconv.FormatInt(time.Now().UnixNano(), 10))
instead of
string(....)
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.
even the TempDir
accepts empty string for defaults and manages everything so I used that and it takes the defaults from that function better than trying to create a specific folder that might have some conflicts
cmd/service/utils.go
Outdated
importedService, err := service.ImportFromPath(path) | ||
var err error | ||
if _, err = url.ParseRequestURI(path); err == nil { | ||
path, err = gitClone(path) |
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.
The new path
is not forward to the function buildDockerImage
thus it cannot build it..
…ce, build the image and injec the config
Now it is possible to automatically fetch the sources from any git repository from the cli.
The following commands are now working and behave like expected (fetch the repository and then build and deploy or test the service)
mesg-core service test https://github.com/mesg-foundation/service-ethereum.git
mesg-core service deploy https://github.com/mesg-foundation/service-ethereum.git
For now it's not testable because example are already updated according to the pull request #183, we need to merge this one first and test again that everything works fine
fix #157