Skip to content

Commit

Permalink
Merge pull request #574 from aml-org/publish-6.2.2
Browse files Browse the repository at this point in the history
Publish 6.2.2
  • Loading branch information
looseale authored Dec 14, 2022
2 parents 4e7c913 + 2c5d079 commit 305edac
Show file tree
Hide file tree
Showing 7 changed files with 195 additions and 221 deletions.
66 changes: 1 addition & 65 deletions Dockerfile
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
176 changes: 103 additions & 73 deletions Jenkinsfile
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)
}
}
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import amf.core.internal.metamodel.Type
import amf.core.internal.metamodel.document.DocumentModel.Encodes
import amf.core.internal.metamodel.document.ModuleModel.{Declares, References}
import amf.core.internal.parser.domain.{Annotations, Fields}
import org.mulesoft.common.collections._
import org.mulesoft.common.core._

case class Dialect(fields: Fields, annotations: Annotations)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import amf.core.internal.parser.domain.SearchScope.All
import amf.core.internal.parser.domain.{Annotations, ScalarNode, SearchScope, ValueNode}
import amf.core.internal.utils.AmfStrings
import amf.core.internal.validation.CoreValidations.SyamlError
import org.mulesoft.common.collections._
import org.yaml.model._

import scala.collection.immutable
Expand Down Expand Up @@ -108,7 +109,7 @@ class NodeMappingParser(implicit ctx: DialectContext)
val (withTerm, withoutTerm) = properties.partition(_.nodePropertyMapping().option().nonEmpty)
val filterProperties: immutable.Iterable[PropertyMapping] = withTerm
.filter(_.nodePropertyMapping().option().nonEmpty)
.groupBy(p => p.nodePropertyMapping().value())
.legacyGroupBy(p => p.nodePropertyMapping().value())
.flatMap({
case (termKey, values) if values.length > 1 =>
ctx.eh.violation(
Expand Down
Loading

0 comments on commit 305edac

Please sign in to comment.