Uploaded image for project: 'OpenShift Bugs'
  1. OpenShift Bugs
  2. OCPBUGS-73798

oc create secret --from-file adding a linebreak

    • Icon: Bug Bug
    • Resolution: Not a Bug
    • Icon: Undefined Undefined
    • None
    • 4.19.0
    • oc
    • None
    • None
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Description of problem:

          Whenever I'm creating a secret from file, the oc tool is adding a linebreak at the end of the token. This is problematic since the API doesn't recognize the API key and therefore causes a failure. 

      Version-Release number of selected component (if applicable):

          oc version
      Client Version: 4.17.5
      Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
      Server Version: 4.19.21
      Kubernetes Version: v1.32.10

      How reproducible:

          always

      Steps to Reproduce:

          1. Create a file with an API key. Make sure not to add any linebreak to the file. Just the API key.
          2. export the path to the file under MY_TOKEN_PATH
          3. Run oc create secret generic secretname --from-file=mytoken=${MY_TOKEN_PATH} -n default     
          4. Check the secretname secret under default namespace
          

      Actual results:

          mytoken contains a linebreak at the end of the key

      Expected results:

          mytoken contains just the key with no linebreak nor extra space

      Additional info:

          I started noticing this recently (mid-december 2025, maybe even more recent)

              rh-ee-okupka Ondřej Kupka
              jfula@redhat.com Joao Bastos Fula
              None
              None
              Ying Zhou Ying Zhou
              None
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: