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

How is metaparticle expected to interact with CI/CD? #49

Open
brendandburns opened this issue Dec 19, 2017 · 10 comments
Open

How is metaparticle expected to interact with CI/CD? #49

brendandburns opened this issue Dec 19, 2017 · 10 comments

Comments

@brendandburns
Copy link
Contributor

An important (and open) question.

Proposals wanted!

@stealthybox
Copy link
Contributor

Maybe executing the binary with a detach flag could be good?
Return code would naturally reflect whether the application is running properly in the provider.

The provider (k8s/swarm/aci) could decide whether cleanup is necessary for resources in the failure case, or this could be exposed as a flag.

Just brainstorming.

@brendandburns
Copy link
Contributor Author

Yeah, I think that's a great idea!

I might use an environment variable instead of a flag, since flags would require munging the command line. Want to send a PR?

Thanks!

@ahaeber
Copy link

ahaeber commented Jan 11, 2018

Looking at the Java implementation, it seems like Metaparticle is bootstrapped by invoking the Containerize method. And that method checks whether it should execute the method itself, or build & deploy. I would prefer to not having to invoke that method in my code. It makes the code harder to understand and debug.

Why not make an annotation processor for this instead? It mainly needs to look at the annotations anyways. That gets the bootstrapping out of the application code, but you still have the annotations present in the code with container and runtime config.

@brendandburns
Copy link
Contributor Author

brendandburns commented Jan 11, 2018 via email

@ahaeber
Copy link

ahaeber commented Jan 11, 2018

Glad you like the approach. Fortunately there are some helpful tools to make it easier, like Google's auto-service. See http://www.baeldung.com/java-annotation-processing-builder for a tutorial that also links to docs for auto-service. I can try to make a Metaparticle annotation processor too, but not sure how much time I'll have available for that right now.

ahaeber added a commit to ahaeber/package that referenced this issue Jan 12, 2018
Refactor the Metaparticle#Containerize method into a Java Annotation
Processor.

Ref issue metaparticle-io#49

Signed-off-by: Andreas Häber <andreas.haber@puzzel.com>
ahaeber added a commit to ahaeber/package that referenced this issue Jan 12, 2018
Refactor the Metaparticle#Containerize method into a Java Annotation
Processor.

Ref issue metaparticle-io#49

Signed-off-by: Andreas Häber <andreas.haber@puzzel.com>
@ahaeber
Copy link

ahaeber commented Jan 12, 2018

@brendandburns started on the annotation processor in the commit above. Got the annotation processor plumbing added including a unit test, but does not work yet.

@srini85
Copy link
Contributor

srini85 commented Jan 13, 2018

@stealthybox, @brendandburns

Maybe executing the binary with a detach flag could be good?
Return code would naturally reflect whether the application is running properly in the provider.

Would it need to run in detached more or not run at all? CI pipeline may just finish after building and publishing the image right?

@srini85
Copy link
Contributor

srini85 commented Jan 14, 2018

@brendandburns - had an attempt at using environment variable for the dotnet version.

See Pull request
#71

@ahaeber
Copy link

ahaeber commented Jan 15, 2018

@brendandburns After trying out a few options with the Java Annotation Processor I found that it is the wrong place to containerize applications. We're inspecting classes (bits and pieces of the application) so we don't have the full picture here. Maybe package-annotations could be better, like:
package-info.java:

@Runtime(...)
@Package(...)
package io.metaparticle.example.chatserver

However, we don't know anything about its dependencies here. And I think it will be too cumbersome to add that.

I looked a little at the new jlink-facility in Java 9, so we're at the module level. However we still don't have the complete application available to containerize here. Also found that Oracle already considered using using jlink to create Docker containers but found that it didn't give any real benefits (https://bugs.openjdk.java.net/browse/JDK-8190739).

@wagoodman
Copy link
Contributor

wagoodman commented Apr 22, 2018

Just summarizing the above highlighted needed features: For CI/CD I'll need individual independent operations for at least:

  • building a docker image
  • pushing a docker image
  • deploying a docker container + detaching

I vote we try a simpler approach first, then go from there. Anyone have any functional reasons why we shouldn't do this with just environment variables? Say:

  • if METAPARTICLE_CI_BUILD == true then ONLY build
  • if METAPARTICLE_CI_PUSH == true then ONLY push the image
  • if METAPARTICLE_CI_DEPLOY == true then ONLY deploy and don't follow logs (however, the return code should reflect the final deployment status... which implies it should wait for a steady state after all probes have completed successfully).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants