Commit 9257ac06 authored by iSergio's avatar iSergio
Browse files

Jenkins file

parent 72933009
Loading
Loading
Loading
Loading
Loading

.gitlab-ci.yml

deleted100644 → 0
+0 −128
Original line number Diff line number Diff line
image: gis4fun.org/wildfly:20.0.1

variables:
  MAVEN_OPTS: "-Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository"
  MAVEN_CLI_OPTS: "--no-transfer-progress"
  WILDFLY_VERSION: "20.0.1.Final"
  WILDFLY_BASE_CLI: "/opt/wildfly-$WILDFLY_VERSION/bin/jboss-cli.sh --controller=$WILDFLY_URL --user=$WILDFLY_USER --password=$WILDFLY_PASS --connect"
  VERSION: ""

cache:
  untracked: true
  key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
  paths:
    - .m2/repository

stages:
  - init
  - build
  - package
  - deploy

default:
  tags:
    - docker
  interruptible: true
  before_script:
    - |
      if [[ "${CI_COMMIT_TAG}" != ""  ]]; then
        mvn $MAVEN_CLI_OPTS versions:set -DnewVersion=${CI_COMMIT_TAG}
        VERSION=${CI_COMMIT_TAG}
      else
        VERSION=$(mvn $MAVEN_CLI_OPTS -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)
        if [[ "${VERSION}" == *-SNAPSHOT  ]]; then
          mvn $MAVEN_CLI_OPTS versions:set -DnewVersion=${VERSION}
        else
          mvn $MAVEN_CLI_OPTS versions:set -DnewVersion=${VERSION}-SNAPSHOT
          VERSION=${VERSION}-SNAPSHOT
        fi
      fi
      echo "Version set to "$VERSION

init:sonarqube-check:
  stage: init
  variables:
    SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar"  # Defines the location of the analysis task cache
    GIT_DEPTH: "0"  # Tells git to fetch all the branches of the project, required by the analysis task
  cache:
    key: "${CI_JOB_NAME}"
    paths:
      - .sonar/cache
  script:
    - mvn verify sonar:sonar -Dsonar.projectKey=iSergio_cesiumjs4gwt_AYNaLd7kHd36IEwDpRz8
  allow_failure: true
  only:
    - develop # or the name of your main branch

compile:cesiumjs4gwt-main:
  stage: build
  needs: []
  script:
    - mvn $MAVEN_CLI_OPTS -pl cesiumjs4gwt-main -DskipTests=true compile

compile:cesiumjs4gwt-showcase:
  stage: build
  needs: ["compile:cesiumjs4gwt-main"]
  script:
    - mvn $MAVEN_CLI_OPTS -pl cesiumjs4gwt-showcase -DskipTests=true compile -am -DskipTests=true

package:cesiumjs4gwt-main:
  stage: package
  needs: ["compile:cesiumjs4gwt-main"]
  only:
#    - master
    - develop
    - tags
  artifacts:
    name: "cesiumjs4gwt-main"
    paths:
      - cesiumjs4gwt-main/target/*.jar
  script:
    - mvn $MAVEN_CLI_OPTS -pl cesiumjs4gwt-main -DskipTests=true package

package:cesiumjs4gwt-showcase:
  stage: package
  needs: ["package:cesiumjs4gwt-main"]
  only:
#    - master
    - develop
    - tags
  script:
    - mvn $MAVEN_CLI_OPTS -pl cesiumjs4gwt-showcase package -am -DskipTests=true
  artifacts:
    name: "cesiumjs4gwt-showcase"
    paths:
      - cesiumjs4gwt-showcase/target/*.war

deploy:cesiumjs4gwt-main:
  stage: deploy
  needs: ["package:cesiumjs4gwt-main"]
  only:
#    - master
    - develop
    - tags
  script:
    - mvn $MAVEN_CLI_OPTS -pl :cesiumjs4gwt,:cesiumjs4gwt-main -DskipTests=true deploy

deploy:cesiumjs4gwt-showcase:
  stage: deploy
  needs: ["package:cesiumjs4gwt-main", "package:cesiumjs4gwt-showcase"]
  only:
#    - master
    - develop
    - tags
  script:
    - |
      if [[ "${VERSION}" == *-SNAPSHOT ]]; then
        SUFFIX="-SNAPSHOT"
      else
        SUFFIX=""
      fi
      echo "SUFFIX IS "$SUFFIX
      EXISTS=`$WILDFLY_BASE_CLI --commands="deployment-info --server-group=main-server-group --name=cesiumjs4gwt-showcase$SUFFIX.war"`
      echo "$EXISTS"
      if [[ $EXISTS = "" ]]; then
        $WILDFLY_BASE_CLI --commands="deploy cesiumjs4gwt-showcase/target/cesiumjs4gwt-showcase-$VERSION.war --name=cesiumjs4gwt-showcase$SUFFIX.war --server-groups=main-server-group"
      else
        $WILDFLY_BASE_CLI --commands="deploy cesiumjs4gwt-showcase/target/cesiumjs4gwt-showcase-$VERSION.war --name=cesiumjs4gwt-showcase$SUFFIX.war --force"
      fi

Jenkinsfile

0 → 100644
+16 −0
Original line number Diff line number Diff line
pipeline {
    agent {
        docker {
            image 'gis4fun.org/openjdk:11'
            args '-v $HOME/.m2:/root/.m2 -u root'
        }
    }

    stages {
        stage('Build') {
            steps {
                sh 'mvn clean package'
            }
        }
    }
}
 No newline at end of file