Skip to content
This repository has been archived by the owner on Mar 21, 2021. It is now read-only.

Info management endpoint improvements #53

Conversation

PierreBesson
Copy link
Contributor

Requirement for : jhipster/generator-jhipster#7050

  • Add git and maven build properties to /info endpoints (if build .properties files are on the classpath
  • Add the active profiles to /info with a custom InfoContributor

@PierreBesson
Copy link
Contributor Author

In my tests this does work (tested for maven/gradle/angular/react) but we need to first my merge the PR to the lib. Sadly the PR to the lib fails because it is incompatible with the master branch (as I removed some configprops that will become obsolete with this feature).

@gmarziou
Copy link
Contributor

@PierreBesson does it work with --skip-git option?

@pascalgrimaud
Copy link
Member

@PierreBesson : I'll do my best to test and merge this. I understand that the build failed, and I don't see a proper way to automate the tests for these PR in this specific case.

@pascalgrimaud
Copy link
Member

Nice work @PierreBesson !
For me, it works fine:

{
  "display-ribbon-on-profiles": "dev",
  "git": {
    "commit": {
      "id": {
        "abbrev": "a9e1e98",
        "describe": "a9e1e98"
      }
    },
    "branch": "master"
  },
  "build": {
    "version": "0.0.1-SNAPSHOT",
    "artifact": "jhmono",
    "name": "Jhmono",
    "group": "io.github.pascalgrimaud",
    "time": "2018-04-02T16:26:02.164Z"
  },
  "activeProfiles": [
    "prod",
    "swagger"
  ]
}

@pascalgrimaud
Copy link
Member

@PierreBesson : I did more tests tonight and saw some issues. You can look my Travis build, using this branch and your PR: https://travis-ci.org/pascalgrimaud/jhipster/builds/361251919

Here a resume of what it didn't work:

  • for Gateway + Eureka:
curl http://localhost:8080/management/info
{
  "display-ribbon-on-profiles" : "dev"
}

So in this code, pi.activeProfiles is undefined, because activeProfiles doesn't exist

  • for Consul, the application didn't start

I think there is a missing : in this code: https://github.com/PierreBesson/generator-jhipster/blob/3c266b051580006fc49baa009c243b9c7b979ecc/generators/server/templates/src/main/resources/config/bootstrap.yml.ejs#L46
${info.project.version} -> ${info.project.version:}

  • you need to check for React too

@PierreBesson PierreBesson force-pushed the info-management-endpoint-improvements branch from 7f9e639 to 3724f37 Compare April 15, 2018 16:04
@PierreBesson
Copy link
Contributor Author

PierreBesson commented Apr 15, 2018

@pascalgrimaud I think everything is OK now. But when I tried to sync branches across repos with Travis like you do it failed.
For React there should be no problem as it currently doesn't support the ribbon feature.

@pascalgrimaud
Copy link
Member

But when I tried to sync branches across repos with Travis like you do it failed.

It's because your branch didn't use jhipster-framework. You need to update your remove-profile-resource-and-improve-info-endpoint

@pascalgrimaud
Copy link
Member

I made some tests and there are still some issues:

  • you need to update this branch too, as it created file into jhipster-server which doesn't exist anymore
  • I didn't manage to see the value active-profiles, maybe a Spring Boot issue ? Here all the results I have:

In dev:

{
  "display-ribbon-on-profiles" : "dev"
}

In prod:

{"display-ribbon-on-profiles":"dev","git":{"commit":{"id":{"abbrev":"346a30b","describe":"346a30b-dirty"}},"branch":"master"},"build":{"version":"0.0.1-SNAPSHOT","artifact":"jhipster","name":"Jhipster","group":"io.github.pascalgrimaud","time":"2018-04-22T10:15:35.882Z"}}

@pascalgrimaud
Copy link
Member

I think I fixed all issues.
I will PR to your branch @PierreBesson

@PierreBesson
Copy link
Contributor Author

You are the best @pascalgrimaud !

@pascalgrimaud
Copy link
Member

@PierreBesson : here my PR against your branch PierreBesson#1
Here the full Travis build: https://travis-ci.org/pascalgrimaud/jhipster/builds/369770495

@pascalgrimaud
Copy link
Member

Here for the generator-jhipster: PierreBesson/generator-jhipster#4

…ment-endpoint-improvements

Move to jhipster-framework folder and fix Conditional Bean
@pascalgrimaud pascalgrimaud merged commit b25f2a7 into jhipster:master Apr 25, 2018
@PierreBesson
Copy link
Contributor Author

Thanks a lot @pascamgrimaud for your efforts getting this merged. Finally we can get commit information in our build and info endpoint. The next step is to use this info to correctly tag the docker image.

@pascalgrimaud
Copy link
Member

ahahaha, you're welcome !
But you should return to bed @PierreBesson, you need more sleep than me 😆

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
4 participants