-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #574 from aml-org/publish-6.2.2
Publish 6.2.2
- Loading branch information
Showing
7 changed files
with
195 additions
and
221 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1 @@ | ||
FROM ubuntu:18.04 | ||
|
||
ARG USER_HOME_DIR="/root" | ||
|
||
ENV SCALA_VERSION 2.12.11 | ||
ENV SBT_VERSION 1.6.1 | ||
|
||
# Update the repository sources list and install dependencies | ||
RUN apt-get update | ||
|
||
RUN apt-get install -y software-properties-common unzip htop rsync openssh-client jq | ||
|
||
# Set the locale | ||
RUN apt-get update && apt-get install -y locales | ||
RUN echo "en_US UTF-8" >> /etc/locale.gen | ||
RUN dpkg-reconfigure locales | ||
RUN locale-gen en_US.UTF-8 | ||
RUN localedef -c -i en_US -f UTF-8 en_US.UTF-8 | ||
ENV LANG en_US.UTF-8 | ||
ENV LANGUAGE en_US:en | ||
ENV LC_ALL en_US.UTF-8 | ||
|
||
# install Java | ||
USER root | ||
RUN mkdir -p /usr/share/man/man1 && \ | ||
apt-get update -y && \ | ||
apt-get install -y openjdk-8-jdk | ||
|
||
RUN apt-get install unzip -y && \ | ||
apt-get autoremove -y && \ | ||
apt-get install git -y | ||
|
||
# Install Scala | ||
## Piping curl directly in tar | ||
RUN \ | ||
apt-get install curl --assume-yes && \ | ||
curl -fsL http://downloads.typesafe.com/scala/$SCALA_VERSION/scala-$SCALA_VERSION.tgz | tar xfz - -C /root/ && \ | ||
echo >> /root/.bashrc && \ | ||
echo 'export PATH=~/scala-$SCALA_VERSION/bin:$PATH' >> /root/.bashrc | ||
|
||
# Install sbt | ||
RUN \ | ||
curl -L -o sbt-$SBT_VERSION.deb https://scala.jfrog.io/artifactory/debian/sbt-$SBT_VERSION.deb && \ | ||
dpkg -i sbt-$SBT_VERSION.deb && \ | ||
rm sbt-$SBT_VERSION.deb && \ | ||
sbt -Dsbt.rootdir=true sbtVersion | ||
|
||
VOLUME "$USER_HOME_DIR/.sbt" | ||
|
||
# Install nodejs | ||
RUN \ | ||
curl -sL https://deb.nodesource.com/setup_8.x | bash - | ||
|
||
RUN \ | ||
apt-get install nodejs --assume-yes | ||
|
||
ENV LANG en_US.UTF-8 | ||
ENV LANGUAGE en_US:en | ||
ENV LC_ALL en_US.UTF-8 | ||
ENV JAVA_TOOL_OPTIONS -Dfile.encoding=UTF8 | ||
|
||
# Final user and home config | ||
RUN useradd --create-home --shell /bin/bash jenkins | ||
USER jenkins | ||
WORKDIR /home/jenkins | ||
FROM ghcr.io/aml-org/amf-ci-tools-base-image:1.2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,90 +1,120 @@ | ||
#!groovy | ||
@Library('amf-jenkins-library') _ | ||
|
||
import groovy.transform.Field | ||
|
||
def SLACK_CHANNEL = '#amf-jenkins' | ||
def PRODUCT_NAME = "amf-aml" | ||
def lastStage = "" | ||
def color = '#FF8C00' | ||
def headerFlavour = "WARNING" | ||
@Field AMF_JOB = "application/AMF/amf/develop" | ||
@Field AMF_CUSTOM_VALIDATOR_SCALAJS_JOB = "application/AMF/amf-custom-validator-scalajs/develop" | ||
|
||
pipeline { | ||
agent { | ||
dockerfile { | ||
filename 'Dockerfile' | ||
registryCredentialsId 'dockerhub-pro-credentials' | ||
options { | ||
timeout(time: 30, unit: 'MINUTES') | ||
ansiColor('xterm') | ||
} | ||
} | ||
environment { | ||
NEXUS = credentials('exchange-nexus') | ||
GITHUB_ORG = 'aml-org' | ||
GITHUB_REPO = 'amf-aml' | ||
} | ||
stages { | ||
stage('Test') { | ||
steps { | ||
wrap([$class: 'AnsiColorBuildWrapper', 'colorMapName': 'XTerm']) { | ||
sh 'sbt -mem 4096 -Dfile.encoding=UTF-8 clean coverage test coverageAggregate' | ||
agent { | ||
dockerfile { | ||
registryCredentialsId 'dockerhub-pro-credentials' | ||
registryCredentialsId 'github-salt' | ||
registryUrl 'https://ghcr.io' | ||
} | ||
} | ||
} | ||
stage('Coverage') { | ||
when { | ||
anyOf { | ||
branch 'master' | ||
branch 'develop' | ||
} | ||
} | ||
steps { | ||
wrap([$class: 'AnsiColorBuildWrapper', 'colorMapName': 'XTerm']) { | ||
withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'sonarqube-official', passwordVariable: 'SONAR_SERVER_TOKEN', usernameVariable: 'SONAR_SERVER_URL']]) { | ||
sh 'sbt -Dsonar.host.url=${SONAR_SERVER_URL} sonarScan' | ||
} | ||
} | ||
} | ||
environment { | ||
NEXUS = credentials('exchange-nexus') | ||
NEXUSIQ = credentials('nexus-iq') | ||
GITHUB_ORG = 'aml-org' | ||
GITHUB_REPO = 'amf-aml' | ||
BUILD_NUMBER = "${env.BUILD_NUMBER}" | ||
BRANCH_NAME = "${env.BRANCH_NAME}" | ||
NPM_TOKEN = credentials('npm-mulesoft') | ||
CURRENT_VERSION = sh(script: "cat dependencies.properties | grep \"version\" | cut -d '=' -f 2", returnStdout: true) | ||
} | ||
stage('Publish') { | ||
when { | ||
anyOf { | ||
branch 'master' | ||
branch 'develop' | ||
stages { | ||
stage('Test') { | ||
steps { | ||
script { | ||
lastStage = env.STAGE_NAME | ||
sh 'sbt -mem 4096 -Dfile.encoding=UTF-8 clean coverage test coverageAggregate' | ||
} | ||
} | ||
} | ||
} | ||
steps { | ||
wrap([$class: 'AnsiColorBuildWrapper', 'colorMapName': 'XTerm']) { | ||
sh ''' | ||
echo "about to publish in sbt" | ||
sbt publish | ||
echo "sbt publishing successful" | ||
''' | ||
stage('Coverage') { | ||
when { | ||
anyOf { | ||
branch 'master' | ||
branch 'develop' | ||
} | ||
} | ||
steps { | ||
withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'sonarqube-official', passwordVariable: 'SONAR_SERVER_TOKEN', usernameVariable: 'SONAR_SERVER_URL']]) { | ||
script { | ||
lastStage = env.STAGE_NAME | ||
sh 'sbt -Dsonar.host.url=${SONAR_SERVER_URL} -Dsonar.login=${SONAR_SERVER_TOKEN} sonarScan' | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
stage('Triggers') { | ||
when { | ||
anyOf { | ||
branch 'develop' | ||
stage('Publish') { | ||
when { | ||
anyOf { | ||
branch 'master' | ||
branch 'develop' | ||
} | ||
} | ||
steps { | ||
script { | ||
lastStage = env.STAGE_NAME | ||
sh ''' | ||
echo "about to publish in sbt" | ||
sbt publish | ||
echo "sbt publishing successful" | ||
''' | ||
} | ||
} | ||
} | ||
} | ||
steps { | ||
script { | ||
echo "Triggering amf on develop branch" | ||
build job: 'application/AMF/amf/develop', wait: false | ||
|
||
echo "Triggering amf-custom-validator-scalajs on develop branch" | ||
build job: 'application/AMF/amf-custom-validator-scalajs/develop', wait: false | ||
stage('Triggers') { | ||
when { | ||
anyOf { | ||
branch 'develop' | ||
} | ||
} | ||
steps { | ||
script { | ||
lastStage = env.STAGE_NAME | ||
echo "Triggering amf on develop branch" | ||
build job: AMF_JOB, wait: false | ||
echo "Triggering amf-custom-validator-scalajs on develop branch" | ||
build job: AMF_CUSTOM_VALIDATOR_SCALAJS_JOB, wait: false | ||
} | ||
} | ||
} | ||
stage('Tag version') { | ||
when { | ||
anyOf { | ||
branch 'master' | ||
} | ||
} | ||
steps { | ||
withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'github-salt', passwordVariable: 'GITHUB_PASS', usernameVariable: 'GITHUB_USER']]) { | ||
script { | ||
lastStage = env.STAGE_NAME | ||
def version = sbtArtifactVersion("amlJVM") | ||
tagCommitToGithub(version) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
stage('Tag version') { | ||
when { | ||
anyOf { | ||
branch 'master' | ||
branch 'support/*' | ||
post { | ||
unsuccessful { | ||
failureSlackNotify(lastStage, SLACK_CHANNEL, PRODUCT_NAME) | ||
} | ||
} | ||
steps { | ||
withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'github-salt', passwordVariable: 'GITHUB_PASS', usernameVariable: 'GITHUB_USER']]) { | ||
script { | ||
def version = sbtArtifactVersion("amlJVM") | ||
tagCommitToGithub(version) | ||
} | ||
success { | ||
successSlackNotify(SLACK_CHANNEL, PRODUCT_NAME) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.