jhipster / generator-jhipster

JHipster is a development platform to quickly generate, develop, & deploy modern web applications & microservice architectures.
https://www.jhipster.tech
Apache License 2.0
21.54k stars 4.02k forks source link

generated CircleCI config.yml for microservice fails when installing docker on CircleCI #19123

Closed indiepopart closed 2 years ago

indiepopart commented 2 years ago
Overview of the issue

I am working with the Reactive JHipster example from Okta. I generate the CircleCI config for the store microservice with JHipster. The generated config fails during the docker installation step on CircleCI platform. I tried to fix the docker install step, but the pipeline then fails in the backend tests step.

Motivation for or Use Case

The generated .circleci/config.yml for microservices fails on CircleCI platform.

Reproduce the error
  1. Get reactive-ms.jdl
  2. jhipster jdl reactive-ms.jdl
  3. cd store
  4. jhipster ci-cd
  5. push store to a public Github repository
  6. Create a CircleCI account, use github for sign up
  7. Create a store project, use .circleci/config.yml from main branch
  8. Execute the pipeline --> Exited with code exit status 2 on "Install docker and docler-compose" step

CircleCI error during docker install: docker-install-issue.txt CircleCI error during backend tests: container-tests-issue.txt

Related issues
Suggest a Fix

I changed the execution environment to VM, as docker is included and it is also adviced by Testcontainers The following config.yml worked for me:

version: 2.1
jobs:
  build:
    environment:
      IMAGE_NAME: indiepopart/store
    machine:
      image: ubuntu-2004:current
    resource_class: 2xlarge
    steps:
      - checkout
      - restore_cache:
          keys:
            - v2-dependencies-{{ checksum "build.gradle" }}-{{ checksum "package-lock.json" }}-{{ arch }}
            # Perform a Partial Cache Restore (https://circleci.com/docs/2.0/caching/#restoring-cache)
            - v2-dependencies-
      - run:
          name: Print Java Version
          command: 'java -version'
      - run:
          name: Print Node Version
          command: 'node -v'
      - run:
          name: Print NPM Version
          command: 'npm -v'
      - run:
          name: Install Node Modules
          command: 'npm install'
      - save_cache:
          paths:
            - node
            - node_modules
            - ~/.gradle
          key: v2-dependencies-{{ checksum "build.gradle" }}-{{ checksum "package-lock.json" }}-{{ arch }}

      - run:
          name: Give Executable Power
          command: 'chmod +x gradlew'
      - run:
          name: Backend tests
          command: npm run ci:backend:test
      - run:
          name: Build Spring Boot Docker Image
          command: ./gradlew bootBuildImage --imageName=$IMAGE_NAME:$CIRCLE_SHA1
      - run:
          name: Publish Docker Image
          command: |
            echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin
            docker push $IMAGE_NAME:$CIRCLE_SHA1
JHipster Version(s)

JHipster version: 7.8.1

JHipster configuration
JDL definitions
application {
  config {
    baseName gateway 
    reactive true 
    packageName com.okta.developer.gateway
    applicationType gateway
    authenticationType oauth2 
    buildTool gradle 
    clientFramework vue 
    prodDatabaseType postgresql
    serviceDiscoveryType eureka
    testFrameworks [cypress] 
  }
  entities Blog, Post, Tag, Product
}
application {
  config {
    baseName blog
    reactive true
    packageName com.okta.developer.blog
    applicationType microservice 
    authenticationType oauth2
    buildTool gradle
    databaseType neo4j
    devDatabaseType neo4j
    prodDatabaseType neo4j
    enableHibernateCache false
    serverPort 8081
    serviceDiscoveryType eureka
  }
  entities Blog, Post, Tag
}
application {
  config {
    baseName store
    reactive true
    packageName com.okta.developer.store
    applicationType microservice
    authenticationType oauth2
    buildTool gradle
    databaseType mongodb
    devDatabaseType mongodb
    prodDatabaseType mongodb
    enableHibernateCache false
    serverPort 8082
    serviceDiscoveryType eureka
  }
  entities Product
}
entity Blog {
  name String required minlength(3)
  handle String required minlength(2)
}
entity Post {
  title String required
  content TextBlob required
  date Instant required
}
entity Tag {
  name String required minlength(2)
}
entity Product {
  title String required
  price BigDecimal required min(0)
  image ImageBlob
}
relationship ManyToOne {
  Blog{user(login)} to User
  Post{blog(name)} to Blog
}
relationship ManyToMany {
  Post{tag(name)} to Tag{post}
}
paginate Post, Tag with infinite-scroll
paginate Product with pagination
microservice Product with store
microservice Blog, Post, Tag with blog
deployment { 
  deploymentType docker-compose
  appsFolders [gateway, blog, store]
  dockerRepositoryName "mraible"
}
  
Entity configuration(s) entityName.json files generated in the .jhipster directory
Browsers and Operating System
mraible commented 2 years ago

Thanks for the bug report, @indiepopart! I added a bug bounty. Please create a PR if you have time.