cogitoergosum
cogitoergosum

Reputation: 2481

OpenShift : Build failed with 'Invalid Output reference'

I am creating a build configuration with the following YAML. Then, I trigger the build manually with oc. So, the following commands are run.

oc create -f mybuildconfig.yaml
oc start-build bc/ns-bc-myproject --wait

Build configuration YAML:

apiVersion: v1
kind: BuildConfig
metadata:
  labels:
    build: myproject
  name: ns-bc-myproject
  namespace: ns
spec:
  output:
    to:
      kind: ImageStreamTag
      name: 'ns-is-myproject:latest'
  postCommit: {}
  resources: {}
  runPolicy: Serial
  source:
    git:
      ref: dev_1.0
      uri: 'https://github.com/ns/myproject.git'
    type: Git
  strategy:
    sourceStrategy:
      from:
        kind: ImageStreamTag
        name: 'nodejs:10'
        namespace: openshift
    type: Source
  successfulBuildsHistoryLimit: 5

The build never goes through; it keeps failing with the message as Invalid output reference. What is missing?

Upvotes: 2

Views: 4605

Answers (1)

Chris Bolton
Chris Bolton

Reputation: 2314

You need to create an image stream in the namespace where your build config is pushing the image to.

Something like this will work for you:

- apiVersion: v1
  kind: ImageStream
  metadata:
    labels:
      application: ns-is-myproject
    name: ns-is-myproject
    namespace: ns-is-myproject

Upvotes: 4

Related Questions