apiVersion: 1.0.0
metadata:
  name: java-eap-xp2-maven-p5u65
projects:
  - name: microprofile-quickstarts
    source:
#      location: 'https://github.com/jboss-developer/jboss-eap-quickstarts.git'
#      type: git
#      tag: XP_2.0.0.GA
# to be replaced with the final quickstart zip URL. Check with CRW team to provide this zip from CRW itsel
f
      location: 'http://download.hosts.prod.upshift.rdu2.redhat.com/devel/candidates/middleware/eap-xp/JBEAPXP-2.0.0.GA-CR1/jboss-eap-xp-2.0.0.GA-CR1-quickstarts.zip'
      type: zip
components:
  - mountSources: true
    endpoints:
      - name: eap-http
        port: 8080
      - attributes:
          public: 'false'
        name: debug
        port: 8787
      - attributes:
          public: 'false'
        name: eap-management
        port: 9990
    memoryLimit: 1512Mi
    type: dockerimage
    volumes:
      - name: m2
        containerPath: /home/jboss/.m2
    alias: maven
    image: 'registry.redhat.io/codeready-workspaces/plugin-java11-rhel8:2.5'
    env:
      - value: 'true'
        name: WILDFLY_TRACING_ENABLED
      - value: microprofile-opentracing
        name: JAEGER_SERVICE_NAME
      - value: 'true'
        name: JAEGER_REPORTER_LOG_SPANS
      - value: const
        name: JAEGER_SAMPLER_TYPE
      - value: '1'
        name: JAEGER_SAMPLER_PARAM
      - value: '-Xmx200m -XX:MaxRAMPercentage=50.0 -XX:+UseParallelGC -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xms20m -Djava.security.egd=file:/dev/./urandom -Duser.home=/home/jboss -Dinsecure.repositories=WARN'
        name: MAVEN_OPTS
  - endpoints:
      - name: tracing-ui
        port: 16686
    memoryLimit: 128Mi
    type: dockerimage
    alias: jaeger
    image: jaegertracing/all-in-one
  - id: redhat/java11/latest
    type: chePlugin
commands:
# You can remove -Dinsecure.repositories=WARN for the final file as the repositories will be public and with trusted certs
# Until then you have to edit the pom.xml set
#    <maven.redhat.repository.url>http://download.hosts.prod.upshift.rdu2.redhat.com/devel/candidates/middleware/eap-xp/JBEAPXP-2.0.0.GA-CR1/maven-repository/</maven.redhat.repository.url>
#    <!--
#        <maven.redhat.repository.url>${maven.repository.protocol}://maven.repository.redhat.com/ga/</maven.redhat.repository.url>
#    -->
#
  - name: build
    actions:
      - workdir: '${fileDirname}'
        type: exec
        command: mvn -Pbootable-jar -Dinsecure.repositories=WARN clean package
        component: maven
  - name: run
    actions:
      - workdir: '${fileDirname}'
        type: exec
        command: 'mvn -Pbootable-jar -Dinsecure.repositories=WARN org.wildfly.plugins:wildfly-jar-maven-plugin:run'
        component: maven
  - name: start
    actions:
      - workdir: '${fileDirname}'
        type: exec
        command: 'mvn -Pbootable-jar -Dinsecure.repositories=WARN org.wildfly.plugins:wildfly-jar-maven-plugin:start'
        component: maven
  - name: build and run in debug
    actions:
      - workdir: '${fileDirname}'
        type: exec
        command: 'mvn -Pbootable-jar -Dinsecure.repositories=WARN -Dwildfly.bootable.arguments="-b=0.0.0.0" -Dwildfly.bootable.jvmArguments="-agentlib:jdwp=transport=dt_socket,address=0.0.0.0:8787,server=y,suspend=n" clean org.wildfly.plugins:wildfly-jar-maven-plugin:dev && mvn package -Ddev -Dinsecure.repositories=WARN -Pbootable-jar && BOOTABLE_XP_PID=$(jps | grep microprofile-opentracing-bootable.jar | awk ''{print $1}'') && while [[ ( -d /proc/$BOOTABLE_XP_PID ) && ( -z `grep zombie /proc/$BOOTABLE_XP_PID/status` ) ]]; do sleep 1; done'
        component: maven
  - name: hot update
    actions:
      - workdir: '${fileDirname}'
        type: exec
        command: mvn package -Ddev -Dinsecure.repositories=WARN -Pbootable-jar
        component: maven
  - name: stop server
    actions:
      - workdir: '${fileDirname}'
        type: exec
        command: 'mvn -Pbootable-jar -Dinsecure.repositories=WARN org.wildfly.plugins:wildfly-jar-maven-plugin:shutdown'
        component: maven
  - name: dependency analysis
    actions:
      - type: exec
        command: '${HOME}/stack-analysis.sh -f ${current.project.path}/pom.xml -p ${current.project.path}'
        component: maven
  - name: Debug (Attach)
    actions:
      - referenceContent: |
          {
          "version": "0.2.0",
          "configurations": [
          {
              "type": "java",
              "request": "attach",
              "name": "Debug (Attach)",
              "hostName": "localhost",
              "port": 8787
          }
          ]
          }
        type: vscode-launch
