Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-66285

Cant get content file through subshell syntax: $(command) in ssh-agent

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • ssh-agent-plugin
    • None

      I build images usig Jenkinsfile with my versioning which store in txt files.

      And I use ssh-agent in post-actions to remove temporary images.

      So I use command set like this:

      cd /home/jenkins/docker/basic_images
      export REPO="$(cat ./repo.txt)"
      export PHP_VERSION=$(cat ./php-fpm/phpVersion.txt)
      export PHP_IMAGE_NAME=$(cat ./php-fpm/imageName.txt)
      export PHP_IMAGE_VERSION="$(cat ./php-fpm/imageVersion.txt)"
      export PHP_COMMON_IMAGE_NAME=$REPO/basic-php-$PHP_VERSION-$PHP_IMAGE_NAME
      docker rmi $PHP_COMMON_IMAGE_NAME:$PHP_IMAGE_VERSION
      

      And in Console Output I see that result:

      cd /home/jenkins/docker/basic_images
      export REPO=""
      export PHP_VERSION=
      export PHP_IMAGE_NAME=
      export PHP_IMAGE_VERSION=""
      export PHP_COMMON_IMAGE_NAME=/basic-php--
      docker rmi :
      

      I tried many other bash possibilities: single/double quotes, apostrophes, while-cycle; set etc. And always blocked to get data from file to set env.

      Besides other operations, which "echo $PATH", "cat ./<filename>" finished successful.

      So: maybe you offer me the way to solve my problem?
      Thx!

            Unassigned Unassigned
            denisg denis
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: