This is an automated email from the ASF dual-hosted git repository. hansva pushed a commit to branch integration-tests in repository https://gitbox.apache.org/repos/asf/incubator-hop.git
commit 9c824fad363eb40f01f550db27994cc8697e84bb Author: Hans Van Akelyen <[email protected]> AuthorDate: Sun Dec 6 09:45:04 2020 +0100 HOP-2122 --- Dockerfile.unit-tests | 20 +++++++++++++------- Jenkinsfile.daily | 28 ++++++++++++++-------------- 2 files changed, 27 insertions(+), 21 deletions(-) diff --git a/Dockerfile.unit-tests b/Dockerfile.unit-tests index 83c2f2d..72be821 100644 --- a/Dockerfile.unit-tests +++ b/Dockerfile.unit-tests @@ -8,6 +8,11 @@ ENV BRANCH_NAME=$BRANCH_NAME ENV DEPLOYMENT_PATH=/opt # volume mount point ENV VOLUME_MOUNT_POINT=/files +#Jenkins user an group +ENV JENKINS_USER=hop +ENV JENKINS_GROUP=hop +ENV JENKINS_UID=1000 +ENV JENKINS_GID=1000 # any JRE settings you want to pass on # The “-XX:+AggressiveHeap” tells the container to use all memory assigned to the container. @@ -21,22 +26,23 @@ RUN apk update \ && apk add --no-cache bash curl procps \ && rm -rf /var/cache/apk/* \ && mkdir ${VOLUME_MOUNT_POINT} \ - && adduser -D -s /bin/bash -h /home/hop hop \ - && chown hop:hop ${DEPLOYMENT_PATH} \ - && chown hop:hop ${VOLUME_MOUNT_POINT} + && addgroup -g ${JENKINS_GID} ${JENKINS_GROUP} \ + && adduser -D -s /bin/bash -h /home/${JENKINS_USER} --uid ${JENKINS_UID} --ingroup ${JENKINS_GROUP} ${JENKINS_USER} \ + && chown ${JENKINS_USER}:${JENKINS_GROUP} ${DEPLOYMENT_PATH} \ + && chown ${JENKINS_USER}:${JENKINS_GROUP} ${VOLUME_MOUNT_POINT} # copy the hop package from the local resources folder to the container image directory -COPY --chown=hop:hop ./assemblies/client/target/hop-* ${DEPLOYMENT_PATH}/hop.zip +COPY --chown=${JENKINS_USER}:${JENKINS_GROUP} ./assemblies/client/target/hop-* ${DEPLOYMENT_PATH}/hop.zip RUN unzip ${DEPLOYMENT_PATH}/hop.zip -d ${DEPLOYMENT_PATH} \ && rm ${DEPLOYMENT_PATH}/hop.zip \ - && chown -R hop:hop ${DEPLOYMENT_PATH}/hop \ + && chown -R ${JENKINS_USER}:${JENKINS_GROUP} ${DEPLOYMENT_PATH}/hop \ && chmod 700 ${DEPLOYMENT_PATH}/hop/*.sh # make volume available so that hop pipeline and workflow files can be provided easily VOLUME ["/files"] -USER hop +USER ${JENKINS_USER} ENV PATH=$PATH:${DEPLOYMENT_PATH}/hop -WORKDIR /home/hop +WORKDIR /home/${JENKINS_USER} # CMD ["/bin/bash"] ENTRYPOINT [] \ No newline at end of file diff --git a/Jenkinsfile.daily b/Jenkinsfile.daily index b7460ce..e573140 100644 --- a/Jenkinsfile.daily +++ b/Jenkinsfile.daily @@ -80,28 +80,28 @@ pipeline { } steps { echo 'Build & Test' - sh "mvn $MAVEN_PARAMS clean install" - } - } - stage('Code Quality') { - when { - branch 'integration-tests' - } - steps { - echo 'Checking Code Quality on SonarCloud' - withCredentials([string(credentialsId: 'sonarcloud-key-apache-hop', variable: 'SONAR_TOKEN')]) { - sh 'mvn sonar:sonar -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=apache -Dsonar.projectKey=apache_incubator-hop -Dsonar.branch.name=${BRANCH_NAME} -Dsonar.login=${SONAR_TOKEN}' - } + sh "mvn $MAVEN_PARAMS clean install -DskipTests=true" } } + // stage('Code Quality') { + // when { + // branch 'integration-tests' + // } + // steps { + // echo 'Checking Code Quality on SonarCloud' + // withCredentials([string(credentialsId: 'sonarcloud-key-apache-hop', variable: 'SONAR_TOKEN')]) { + // sh 'mvn sonar:sonar -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=apache -Dsonar.projectKey=apache_incubator-hop -Dsonar.branch.name=${BRANCH_NAME} -Dsonar.login=${SONAR_TOKEN}' + // } + // } + // } stage('Create Docker image & Run Tests'){ when { branch 'integration-tests' } steps { script { - dockerImage = docker.build(imagename, "-f Dockerfile.unit-tests .") - dockerImage.inside("-v $WORKSPACE/integration-tests:/files -u hop:hop"){ + dockerImage = docker.build(imagename, "-f Dockerfile.unit-tests -build-arg JENKINS_USER=$(JENKINS_USER) --build-arg JENKINS_UID=$(JENKINS_UID) --build-arg JENKINS_GROUP=$(JENKINS_GROUP) --build-arg JENKINS_GID=$(JENKINS_GID) .") + dockerImage.inside("-v $WORKSPACE/integration-tests:/files"){ echo 'Run tests' sh 'ls /files' sh 'cd /files/scripts && ./run-tests.sh'
