Closed chmouel closed 5 years ago
I tried this
I used command oc new-app . -o yaml --strategy=source --dry-run=true > .openshiftio/application.yaml
which basically generated the list of all objects.
Then I used the loadResources API, and tried to build
Build Config generated is
apiVersion: build.openshift.io/v1
kind: BuildConfig
metadata:
annotations:
openshift.io/generated-by: OpenShiftNewApp
creationTimestamp: null
labels:
app: test-app-new-app
name: test-app-new-app
spec:
nodeSelector: null
output:
to:
kind: ImageStreamTag
name: test-app-new-app:latest
postCommit: {}
resources: {}
source:
git:
uri: https://github.com/piyush-garg/test-app-new-app.git
type: Git
strategy:
sourceStrategy:
from:
kind: ImageStreamTag
name: nodejs:10
namespace: openshift
type: Source
triggers:
- github:
secret: gDsCob43m2sIpeSYQvGZ
type: GitHub
- generic:
secret: n4s1FZJefo85PxHeWeTY
type: Generic
- type: ConfigChange
- imageChange: {}
type: ImageChange
status:
lastVersion: 0
After applying, its throwing error like this
oc apply -f .openshiftio/.tmp-pgarg-preview-22-buildconfig.yaml -n pgarg-preview
Warning: oc apply should be used on resource created by either oc create --save-config or oc apply
The BuildConfig "test-app-new-app" is invalid: spec.strategy: Invalid value: build.BuildStrategy{DockerStrategy:(*build.DockerBuildStrategy)(nil), SourceStrategy:(*build.SourceBuildStrategy)(0xc5a54c13f0), CustomStrategy:(*build.CustomBuildStrategy)(nil), JenkinsPipelineStrategy:(*build.JenkinsPipelineBuildStrategy)(0xc770a63b40)}: must provide a value for exactly one of sourceStrategy, customStrategy, dockerStrategy, or jenkinsPipelineStrategy
I tried upgrading the OC binary to v3.11 also, still does not work. But locally its working fine.
When you say locally, you mean on a minishfit?
Your repo seems to okay to me on OSO account :
osio-pipeline parsing need to be fixed to handle this properly,
Sorry for the confusion, I mean the same, OSO account but without Jenkins, directly oc create
from the command line.
Even I tried to cat after parsing, the file looks good to me, but still not able to apply from our library
Can you cat the output generated in this issue?
[workspace] Running shell script
+ cat .openshiftio/.tmp-pgarg-preview-22-buildconfig.yaml
apiVersion: build.openshift.io/v1
kind: BuildConfig
metadata:
annotations:
openshift.io/generated-by: OpenShiftNewApp
creationTimestamp: null
labels:
app: test-app-new-app
name: test-app-new-app
spec:
nodeSelector: null
output:
to:
kind: ImageStreamTag
name: test-app-new-app:latest
postCommit: {}
resources: {}
source:
git:
uri: https://github.com/piyush-garg/test-app-new-app.git
type: Git
strategy:
sourceStrategy:
from:
kind: ImageStreamTag
name: nodejs:10
namespace: openshift
type: Source
triggers:
- github:
secret: gDsCob43m2sIpeSYQvGZ
type: GitHub
- generic:
secret: n4s1FZJefo85PxHeWeTY
type: Generic
- type: ConfigChange
- imageChange: {}
type: ImageChange
status:
lastVersion: 0
+ oc apply -f .openshiftio/.tmp-pgarg-preview-22-buildconfig.yaml -n pgarg-preview
Warning: oc apply should be used on resource created by either oc create --save-config or oc apply
The BuildConfig "test-app-new-app" is invalid: spec.strategy: Invalid value: build.BuildStrategy{DockerStrategy:(*build.DockerBuildStrategy)(nil), SourceStrategy:(*build.SourceBuildStrategy)(0xc5a54c13f0), CustomStrategy:(*build.CustomBuildStrategy)(nil), JenkinsPipelineStrategy:(*build.JenkinsPipelineBuildStrategy)(0xc770a63b40)}: must provide a value for exactly one of sourceStrategy, customStrategy, dockerStrategy, or jenkinsPipelineStrategy
[Pipeline] error
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
a poc that try to leverage
oc new-app
feature supported on osio-pipeline :.openshiftio/application.yaml
Run OSIO-Pipeline and see if it builds and deploy correctly on OSO/OSD
Identify what things are missing, there is arguments to play with on
oc new-app
to get the template exactly the way we want,