• Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Critical Critical
    • credentials-plugin
    • None

      When using jenkins with docker plugin, If I try to launch a dockerfile from pipeline with credentials as AdditionalArguments:

      def BUILDARGS
      node {
           withCredentials([usernamePassword(credentialsId: 'credId', passwordVariable: 'nexusPassword', usernameVariable: 'nexusUser')]) {
                BUILDARGS = "--build-arg nexusUser=${nexusUser} --build-arg nexusPassword=${nexusPassword}"
           }
      }
      agent {
           dockerfile {
               dir "${projectRootLocation}"
              additionalBuildArgs "$BUILDARGS"
               label 'Docker'
           }
      }

      Jenkins display the content of the command line :

      [Pipeline] sh
      [tform_xxxxxx_master-JY4H63NYHB6VJMKUFIMC2R2JWRWXIDSJ63WJCYILIZ35Y5AVGIUA] Running shell script
      
      docker build -t 5c5a6f87c431d14fd800e3cad7bb1d9af131caa4 --build-arg nexusUser=username --build-arg nexusPassword=password -f ./Dockerfile .
      Sending build context to Docker daemon 123.1MB

      So it possible to hide the password and the user on the command line ?

      Thanks

          [JENKINS-51763] Hide credentials given to the dockerfile

          Vincent Guignot created issue -
          Vincent Guignot made changes -
          Description Original: When using jenkins with docker plugin, If I try to launch a dockerfile from pipeline with credentials as AdditionalArguments:
          {code:java}
          def BUILDARGS
          node {
          withCredentials([usernamePassword(credentialsId: 'credId', passwordVariable: 'nexusPassword', usernameVariable: 'nexusUser')]) {
          BUILDARGS = "--build-arg nexusUser=${nexusUser} --build-arg nexusPassword=${nexusPassword}"
          }
          }
          agent {
               dockerfile {
                   dir "${projectRootLocation}"
                  additionalBuildArgs "$BUILDARGS"
                   label 'Docker'
               }
          }{code}
          Jenkins display the content of the command line :
          {code:java}
          [Pipeline] sh
          [tform_xxxxxx_master-JY4H63NYHB6VJMKUFIMC2R2JWRWXIDSJ63WJCYILIZ35Y5AVGIUA] Running shell script

          docker build -t 5c5a6f87c431d14fd800e3cad7bb1d9af131caa4 --build-arg nexusUser=username --build-arg nexusPassword=password -f ./Dockerfile .
          Sending build context to Docker daemon 123.1MB{code}
          So it possible to hide the password and the user on the command line ?

          Thanks
          New: When using jenkins with docker plugin, If I try to launch a dockerfile from pipeline with credentials as AdditionalArguments:
          {code:java}
          def BUILDARGS
          node {
               withCredentials([usernamePassword(credentialsId: 'credId', passwordVariable: 'nexusPassword', usernameVariable: 'nexusUser')]) {
                    BUILDARGS = "--build-arg nexusUser=${nexusUser} --build-arg nexusPassword=${nexusPassword}"
               }
          }
          agent {
               dockerfile {
                   dir "${projectRootLocation}"
                  additionalBuildArgs "$BUILDARGS"
                   label 'Docker'
               }
          }{code}
          Jenkins display the content of the command line :
          {code:java}
          [Pipeline] sh
          [tform_xxxxxx_master-JY4H63NYHB6VJMKUFIMC2R2JWRWXIDSJ63WJCYILIZ35Y5AVGIUA] Running shell script

          docker build -t 5c5a6f87c431d14fd800e3cad7bb1d9af131caa4 --build-arg nexusUser=username --build-arg nexusPassword=password -f ./Dockerfile .
          Sending build context to Docker daemon 123.1MB{code}
          So it possible to hide the password and the user on the command line ?

          Thanks
          Stephen Connolly made changes -
          Assignee Original: Stephen Connolly [ stephenconnolly ]

            Unassigned Unassigned
            20100 Vincent Guignot
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: