vorburger / www.fineract.dev

https://www.fineract.dev
Apache License 2.0
16 stars 1 forks source link

Continous Deployment (CD) is broken (again) since 3 days #11

Closed vorburger closed 2 years ago

vorburger commented 2 years ago

As per feedback from @ptuomola in #4, the CD is broken (again) since 3 days, after it worked following #8.

The goal of this issue is to fix that again.

vorburger commented 2 years ago

I just had a look at the build last log (and will make it possible for @ptuomola to look at it himself in the future in #10), and it's indeed as @ptuomola suspected an impact of https://github.com/apache/fineract/pull/2009 (https://github.com/apache/fineract/commit/6e052e536be5119b68ae095b923538912fde716a) by @vidakovic:

Step #1: unable to prepare context: unable to evaluate symlinks in Dockerfile path: lstat /workspace/fineract.git/Dockerfile: no such file or directory

Basically what I do for https://www.fineract.dev is simply (something very much like) a docker build. And that doesn't work anymore since there is no Dockerfile anymore now.

The solution here would be to make Google Cloud Build perform a ./gradlew :fineract-provider:jibDockerBuild -x test AND THEN PUSH THE RESULTING CONTAINER IMAGE TO THE GOOGLE CLOUD REGISTRY from where I re-deploy it. I'm not sure yet how to do this.

vorburger commented 2 years ago

https://github.com/coollog/jib-google-cloud-build/ has something about this, but I believe it's outdated; I've created https://github.com/coollog/jib-google-cloud-build/issues/1 about it (@coollog appears to be the original creator of JIB).

https://github.com/GoogleContainerTools/jib/issues/3545 suggests better documenting this on the README of JIB itself.

https://github.com/GoogleContainerTools/jib/tree/master/jib-gradle-plugin#using-google-container-registry-gcr makes it sound like this may be simple? https://cloud.google.com/blog/products/application-development/introducing-jib-build-java-docker-images-better mentioned the same jib.to.image property for gradle jib and gradle jibDockerBuild. I'll try out playing with this some time (and update the issues above with learnings).

PS: A future alternative could perhaps even be doing this through Skaffold, as in https://github.com/GoogleCloudPlatform/microservices-demo/blob/master/cloudbuild.yaml.

vorburger commented 2 years ago

Staring at https://github.com/GoogleCloudPlatform/air-draw-demo/blob/master/cloudbuild.yaml makes me suspect this may be as simple as that... I'll try that.

vidakovic commented 2 years ago

Note: at the moment I am only building that Docker image, but the task can also publish to a Docker repo (which that workflow you pointed to does). So, if we already have credentials in place that authenticate Docker GH Actions against such a repo then running just the "jib" task will take care of it (aka publish the image)... without having looked at the deployment workflow in detail. If you need a helping hand please let me know... and sorry for breaking it ;-)

vorburger commented 2 years ago

Huh, "fun" twist - there does not seem to be a gcr.io/cloud-builders/javac:17 (nor :11, only :8) on https://console.cloud.google.com/gcr/images/cloud-builders/global/java/javac, yet.

@jamesward @ludoch @glaforge @averikitsch can we connect next week at work (Googler myself writing here) to get this done?

It seems like I'm blocked with this issue by that. (Unless there is a workaround I'm not thinking of.)

jamesward commented 2 years ago

The gcr.io/cloud-builders/javac images are not well maintained: https://github.com/GoogleCloudPlatform/cloud-builders/tree/master/javac

Good alternatives: https://github.com/GoogleContainerTools/distroless/tree/main/java

So like:

gcr.io/distroless/java17-debian11

Which might not contain what you need to build something, in which case use the following in CI:

gcr.io/distroless/java17-debian11:debug
vorburger commented 2 years ago

@jamesward Oh! Right. I assumed, without verifying, that gcr.io/cloud-builders/javac had something specific related to being a "cloud builder" image. Notably the GCR credential helper I had suspected we'll need for JIB for this project (without having tried it).

I gather from your comment, and looking at it, that this is not the case (so cloud-builders/javac is really "just" JDK + Docker), and any Java image will work... (So either JIB itself includes whatever it needs to push images to various registries - or that some additional investigation and work will be required to make jib.to.image work anyway; but I suspect it's the former, so this will "just work"; I'll try it out!)

jamesward commented 2 years ago

Yes it should just work, assuming that your Cloud Build service account has the right permissions.

vorburger commented 2 years ago

@jamesward FYI a ./gradlew in gcr.io/distroless/java17-debian11:debug failed (for me) with:

Step #1: standard_init_linux.go:228: exec user process caused: no such file or directory

but using (e.g.) docker.io/library/eclipse-temurin:17 for https://hub.docker.com/_/eclipse-temurin/ from https://adoptium.net works.

With this, https://demo.fineract.dev/fineract-provider/actuator/info shows the latest commit of https://github.com/apache/fineract again, and I'm closing this issue as resolved. (I've stumbled upon new https://issues.apache.org/jira/browse/FINERACT-1480, which probably broke a while ago, and is not directly related to this.)

PS: I'll follow up for JIB with Google Cloud Build in general, unrelated to https://www.fineract.dev per se, in https://github.com/GoogleContainerTools/jib/issues/3545.