metadata:
  name: containerSaveImage
  description: Saves a container image as a tar file
  longDescription: |-
    This step allows you to save a container image, for example a Docker image into a tar file.

    It can be used no matter if a Docker daemon is available or not. It will also work inside a Kubernetes cluster without access to a daemon.
spec:
  inputs:
    secrets:
      - name: dockerConfigJsonCredentialsId
        description: Jenkins 'Secret file' credentials ID containing Docker config.json (with registry credential(s)). You can find more details about the Docker credentials in the [Docker documentation](https://docs.docker.com/engine/reference/commandline/login/).
        type: jenkins
        aliases:
          - name: dockerCredentialsId
            deprecated: true
    params:
      - name: containerRegistryUrl
        aliases:
          - name: dockerRegistryUrl
        type: string
        description: "For `buildTool: docker`: Url of the container registry - typically provided by the CI/CD environment."
        mandatory: true
        resourceRef:
          - name: commonPipelineEnvironment
            param: container/registryUrl
        scope:
          - GENERAL
          - PARAMETERS
          - STAGES
          - STEPS
      - name: containerImage
        aliases:
          - name: dockerImage
          - name: scanImage
        type: string
        description: Container image to be saved.
        mandatory: true
        resourceRef:
          - name: commonPipelineEnvironment
            param: container/imageNameTag
        scope:
          - GENERAL
          - PARAMETERS
          - STAGES
          - STEPS
      - name: containerRegistryPassword
        description: "For `buildTool: docker`: Password for container registry access - typically provided by the CI/CD environment."
        type: string
        scope:
          - PARAMETERS
          - STAGES
          - STEPS
        secret: true
        resourceRef:
          - name: commonPipelineEnvironment
            param: container/repositoryPassword
          - name: commonPipelineEnvironment
            param: custom/repositoryPassword
      - name: containerRegistryUser
        description: "For `buildTool: docker`: Username for container registry access - typically provided by the CI/CD environment."
        type: string
        scope:
          - PARAMETERS
          - STAGES
          - STEPS
        secret: true
        resourceRef:
          - name: commonPipelineEnvironment
            param: container/repositoryUsername
          - name: commonPipelineEnvironment
            param: custom/repositoryUsername
      - name: filePath
        type: string
        description: The path to the file to which the image should be saved.
        scope:
          - PARAMETERS
          - STAGES
          - STEPS
      - name: dockerConfigJSON
        type: string
        description: Path to the file `.docker/config.json` - this is typically provided by your CI/CD system. You can find more details about the Docker credentials in the [Docker documentation](https://docs.docker.com/engine/reference/commandline/login/).
        scope:
          - PARAMETERS
          - STAGES
          - STEPS
        secret: true
        resourceRef:
          - name: commonPipelineEnvironment
            param: custom/dockerConfigJSON
          - name: dockerConfigJsonCredentialsId
            type: secret
          - type: vaultSecretFile
            name: dockerConfigFileVaultSecretName
            default: docker-config
      - name: imageFormat
        type: string
        description: Format of the image when saving the docker image locally.
        scope:
          - PARAMETERS
          - STAGES
          - STEPS
        default: legacy
        possibleValues:
          - tarball
          - oci
          - legacy
