-1

I am using OpenShift V4 and trying to create a secret called artifactory-credential which contains Username and Password and is of type 'Opaque'.

I am passing the Username and Password to a secret.yaml file as below

metadata:
  name: "${APP_NAME}-secret"
objects:
  - apiVersion: v1
    kind: Secret
    metadata:
      labels:
        app: ${APP_NAME}
      name: artifactory-credential
    type: Opaque
    stringData:
      username: ${ARTIFACTORY_USER}
      password: ${ARTIFACTORY_PASSWORD}
parameters:
  - name: ARTIFACTORY_USER
    description: "artifactory credential user"
    required: true
  - name: ARTIFACTORY_PASSWORD
    description: "artifactory credential password"

And my build.yaml file has this section:

 spec:
      source:
        type: Secret
        binary: {}
        secrets:
          - secret:
              name: artifactory-credential
              destinationDir: /opt/app-root/src

When I run jenkins pipeline script, I get this error :

### ARTIFACTORY_CREDENTIAL must be set with the mounted artifactory-credential file path inside '/opt/app-root/src/' ###

Any idea why this is happening and what can I do to fix it?

ljs
  • 495
  • 1
  • 8
  • 23

2 Answers2

0

It is asking for ARTIFACTORY_CREDENTIAL env variable in your build environment set up with /opt/app-root/src/artifactory-credential. You can either include it in your build config or provide it through the cli with --env when you start the build.

0

Adding the name to stringData as below worked for me

type: Opaque
    stringData:
      artifactory-credential: |
        username: ${ARTIFACTORY_USER}
        password: ${ARTIFACTORY_PASSWORD}
ljs
  • 495
  • 1
  • 8
  • 23