Uploaded image for project: 'Bamboo Data Center'
  1. Bamboo Data Center
  2. BAM-25810

Docker task doesnt allow variables to be used in the docker task under repository name for Push and Pull commands.

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Low Low
    • 10.0.0, 10.0.0-rc3
    • 9.6.0, 9.6.1, 9.6.2
    • Docker, Tasks
    • None

      Issue Summary

      The Docker task does not allow using variables to point to the name of the image to be used for the task specially for Push and Pull commands

      The repository field in the "Pull a Docker image from repository" and "Push a Docker image to a Docker registry" commands prevents the ${bamboo.variable} syntax from being entered, as it does not meet the regex requirements for a Docker repository name.

      Steps to Reproduce

      1. Add variable with docker registry and image name e.g. registry.address:port/namespace/repository:tag
      2. Add Docker task.
      3. Docker configuration - select option Push a docker image to a docker registry.
      4. Select Custom registry and paste ${bamboo.image}

      Expected Results

      Variable under repository field is been recognized for "Pull a Docker image from repository" and "Push a Docker image to a Docker registry" commands

      Actual Results

      The variable is not recognized in the repository and the below error is seen int he UI when we try to save the task

      "You must specify a registry address when pushing to a custom registry"

      The piece of code where the issue seems to be restricted to the config validation only, i.e. if that would accept variables for the namespace and repository parts, the execution would resolve and use those correctly.

      The responsible validation code can be found in the respective validator implementations, and the PushConfigValidator

        • Both validators attempt to parse the content of the Repository field into their respective parts, i.e. "registry/namespace/repository:tag" in order to then validate the namespace and the repository parts against respective regex patterns that do not accept Bamboo variables!
          • The registry and tag parts are not validated at all, hence they allow variable usage.

      Workaround

      you can create a 'script' task with inline content: "docker push ${bamboo.variable}" or "docker pull ${bamboo.variable}"
      to achieve this purpose.

            [BAM-25810] Docker task doesnt allow variables to be used in the docker task under repository name for Push and Pull commands.

            Bruno Benvenuti made changes -
            Resolution New: Fixed [ 1 ]
            Status Original: Waiting for Release [ 12075 ] New: Closed [ 6 ]
            SET Analytics Bot made changes -
            UIS Original: 1 New: 0
            Shashank Kumar made changes -
            Remote Link Original: This issue links to "Page (Confluence)" [ 923170 ]
            Shashank Kumar made changes -
            Remote Link New: This issue links to "Page (Confluence)" [ 923170 ]
            Alexey Chystoprudov made changes -
            Fix Version/s New: 10.0.0-rc2 [ 108510 ]
            Shashank Kumar made changes -
            Remote Link New: This issue links to "Page (Confluence)" [ 920771 ]
            Mateusz Szmal made changes -
            Fix Version/s New: 10.0.0 [ 107511 ]
            Mateusz Szmal made changes -
            Status Original: In Progress [ 3 ] New: Waiting for Release [ 12075 ]
            Mateusz Szmal made changes -
            Status Original: Needs Triage [ 10030 ] New: In Progress [ 3 ]
            Mateusz Szmal made changes -
            Assignee New: Mateusz Szmal [ 851f15845f55 ]

              851f15845f55 Mateusz Szmal
              f84a05b06223 Anik Sengupta
              Affected customers:
              0 This affects my team
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: