okteto / java-maven-getting-started

Develop Java Maven Apps in Kubernetes with Okteto
https://www.okteto.com
Apache License 2.0
4 stars 21 forks source link

Upgrade the example #7

Open jabrena opened 1 year ago

jabrena commented 1 year ago

I am going to review the example to upgrade:

pchico83 commented 1 year ago

@jabrena that would be awesome, thanks!

jabrena commented 1 year ago

Hi @pchico83,

I have few questions about okteto.yml

The Docker image is generated from this section:

build:
  hello-world:
    image: okteto.dev/java-maven-hello-world:1.0.0
    context: .

Does exist a way to run a maven goal like:

mvn package spring-boot:buildImage

or it is possible to run a bash script for complex scenarios?

Where is located the documentation about octeto.yml?

pchico83 commented 1 year ago

@jabrena The documentation is here: https://www.okteto.com/docs/reference/manifest/

You could use the deploy section to run mvn commands. But that would only work if you have mvn installed locally, which we cannot assume

jabrena commented 1 year ago

I am thinking that maybe it is better to run everything in a multi layer Dockerfile and continue with the normal workflow.

I will do some experiments before sending the PR

Many thanks in advance @pchico83

jabrena commented 1 year ago

Hi @pchico83,

I am testing the changes in my branch: https://github.com/jabrena/java-maven-getting-started/tree/feature/upgrade-sb-3

but I would like to import in Okteto cloud my repository: https://cloud.okteto.com/deploy?repository=https://github.com/jabrena/java-maven-getting-started/tree/feature/upgrade-sb-3

but what it the right way to use the endpoint:

-https://cloud.okteto.com/deploy?repository=REPOSITORY_X

in order to indicate the right branch to clone? Currently, the system only clone the default git branch but I would like to clone a specific branch to run the whole process.

"okteto" has been added to your repositoriesHang tight while we grab the latest from your chart repositories......
Successfully got an update from the "okteto" chart repositoryUpdate Complete. 
⎈Happy Helming!⎈
checkout command: '[git clone --depth 1 https://github.com/jabrena/java-maven-getting-started/tree/feature/upgrade-sb-3 /okteto/src]'
Cloning git repository 'https://github.com/jabrena/java-maven-getting-started/tree/feature/upgrade-sb-3'...
Cloning into '/okteto/src'...fatal: repository 'https://github.com/jabrena/java-maven-getting-started/tree/feature/upgrade-sb-3/' not found
failed to clone repository with URL 'https://github.com/jabrena/java-maven-getting-started/tree/feature/upgrade-sb-3'git-pull

With my tests executed, I will send the PR.

Tell me

Juan Antonio

pchico83 commented 1 year ago

Hi @pchico83,

I am testing the changes in my branch: https://github.com/jabrena/java-maven-getting-started/tree/feature/upgrade-sb-3

but I would like to import in Okteto cloud my repository: https://cloud.okteto.com/deploy?repository=https://github.com/jabrena/java-maven-getting-started/tree/feature/upgrade-sb-3

but what it the right way to use the endpoint:

-https://cloud.okteto.com/deploy?repository=REPOSITORY_X

in order to indicate the right branch to clone? Currently, the system only clone the default git branch but I would like to clone a specific branch to run the whole process.

"okteto" has been added to your repositoriesHang tight while we grab the latest from your chart repositories......
Successfully got an update from the "okteto" chart repositoryUpdate Complete. 
⎈Happy Helming!⎈
checkout command: '[git clone --depth 1 https://github.com/jabrena/java-maven-getting-started/tree/feature/upgrade-sb-3 /okteto/src]'
Cloning git repository 'https://github.com/jabrena/java-maven-getting-started/tree/feature/upgrade-sb-3'...
Cloning into '/okteto/src'...fatal: repository 'https://github.com/jabrena/java-maven-getting-started/tree/feature/upgrade-sb-3/' not found
failed to clone repository with URL 'https://github.com/jabrena/java-maven-getting-started/tree/feature/upgrade-sb-3'git-pull

With my tests executed, I will send the PR.

Tell me

Juan Antonio

@jabrena you can do things like this:

https://cloud.okteto.com/deploy?repository=https://github.com/okteto/movies&branch=main
jabrena commented 1 year ago

I have just sent a PR with the changes: https://github.com/okteto/java-maven-getting-started/pull/8

It is working fine, can you squash and merge when you have time?

jabrena commented 1 year ago

Hi @pchico83,

Something that I don´t understand is the image used in the deployment:

2023-01-13 15:36:32.02 UTChello-world-dcf754c59-cwl6thello-world
2023-01-13 15:36:32.02 UTChello-world-dcf754c59-cwl6thello-world . ____ _ __ _ _
2023-01-13 15:36:32.02 UTChello-world-dcf754c59-cwl6thello-world /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
2023-01-13 15:36:32.02 UTChello-world-dcf754c59-cwl6thello-world( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
2023-01-13 15:36:32.02 UTChello-world-dcf754c59-cwl6thello-world \\/ ___)| |_)| | | | | || (_| | ) ) ) )
2023-01-13 15:36:32.02 UTChello-world-dcf754c59-cwl6thello-world ' |____| .__|_| |_|_| |_\__, | / / / /
2023-01-13 15:36:32.02 UTChello-world-dcf754c59-cwl6thello-world =========|_|==============|___/=/_/_/_/
2023-01-13 15:36:32.02 UTChello-world-dcf754c59-cwl6thello-world :: Spring Boot :: (v2.1.8.RELEASE)
2023-01-13 15:36:32.02 UTChello-world-dcf754c59-cwl6thello-world
2023-01-13 15:36:32.64 UTChello-world-dcf754c59-cwl6thello-world2023-01-13 15:36:32.638 INFO 7 --- [ main] com.oktet

It is not using the latest image. Why?

jabrena commented 1 year ago

I found the address in the logs:

Image 'registry.cloud.okteto.net/jabrena/java-maven-hello-world:1.0.0' successfully pushed

is it necessary to change something in okteto.yml or k8s.yml?

pchico83 commented 1 year ago

@jabrena it's using a fixed image: https://github.com/okteto/java-maven-getting-started/blob/main/k8s.yml#L15

If you want to get the latest changes, restart the pod and it will pull the latest changes. I reverted your changes because we were getting runtime errors after okteto deploy --build, could you have a look and re-submmit the PR?