wilzbach / dlang-docker

Automated Docker images for D
https://dlang.org/download.html
19 stars 9 forks source link

Add user dlang to ubuntu docker #15

Closed andre2007 closed 4 years ago

andre2007 commented 4 years ago

By executing the docker container with a non root user, security risks are mitigated and technical issues are avoided (like non deletable files on Jenkins workspace due to root permissions).

This pr adds an user dlang which is owner of folder /dlang. By default, still the user root is used by starting a container of this image.

andre2007 commented 4 years ago

This pr will make the docker image usable in Jenkins Pipeline Piper step https://sap.github.io/jenkins-library/steps/dubExecute/.

andre2007 commented 4 years ago

@wilzbach Thanks a lot. I just tried it, and it works great now.

In Jenkins pipeline you can now use dubExecute to e.g. run D-Scanner or create unit tests coverage files. The results of these two commands (report.json / *.lst) are provided to the NG warnings plugin / Coverage plugin and are attached to the Jenkins job.

  if (env.BRANCH_NAME != 'master') {
    stage('Pull-request voting') {
      node {
        deleteDir()
        checkout scm

        parallel (
          linter: {
            dubExecute script: this, dubCommand: 'run dscanner -y --vquiet -- --report . > report.json'
            recordIssues failOnError: true, tools: [dscanner(pattern: 'report.json')]
          },
          coverage: {
            dubExecute script: this, dubCommand: 'test --coverage'
            publishCoverage adapters: [dListingAdapter(mergeToOneReport: true, path: '*.lst')], sourceFileResolver: sourceFiles('STORE_LAST_BUILD')
          }
        )
      }
    }
  }