Skip to content

Commit 3ff3c74

Browse files
chore(load_pipelinerun): show how to validate one uses test
1 parent 5105afc commit 3ff3c74

File tree

2 files changed

+25
-21
lines changed

2 files changed

+25
-21
lines changed

pkg/triggerconfig/inrepo/load_pipelinerun.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,11 @@ func unmarshalAndConvertPipelineRun(data []byte, message string) (*pipelinev1.Pi
175175
if err := yaml.Unmarshal(data, prsV1Beta1); err != nil {
176176
return nil, errors.Wrapf(err, "failed to unmarshal PipelineRun v1beta1 YAML %s", message)
177177
}
178-
prsV1 := &pipelinev1.PipelineRun{}
178+
prsV1 := &pipelinev1.PipelineRun{
179+
TypeMeta: metav1.TypeMeta{
180+
Kind: prsV1Beta1.Kind,
181+
APIVersion: TektonAPIVersion,
182+
}}
179183
if err := prsV1Beta1.ConvertTo(context.TODO(), prsV1); err != nil {
180184
return nil, errors.Wrap(err, "failed to convert PipelineRun from v1beta1 to v1")
181185
}

pkg/triggerconfig/inrepo/test_data/load_pipelinerun/uses-all-steps/expected.yaml

+20-20
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
apiVersion: tekton.dev/v1beta1
1+
apiVersion: tekton.dev/v1
22
kind: PipelineRun
33
metadata:
44
creationTimestamp: null
@@ -151,6 +151,10 @@ spec:
151151
type: string
152152
spec: null
153153
stepTemplate:
154+
computeResources:
155+
requests:
156+
cpu: 400m
157+
memory: 512Mi
154158
env:
155159
- name: BUILD_ID
156160
value: $(params.BUILD_ID)
@@ -178,16 +182,11 @@ spec:
178182
value: $(params.REPO_OWNER)
179183
- name: REPO_URL
180184
value: $(params.REPO_URL)
181-
name: ""
182-
resources:
183-
requests:
184-
cpu: 400m
185-
memory: 512Mi
186185
workingDir: /workspace/source
187186
steps:
188-
- image: gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/git-init:v0.19.0
187+
- computeResources: {}
188+
image: gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/git-init:v0.19.0
189189
name: git-clone
190-
resources: {}
191190
script: |
192191
#!/bin/sh
193192
export SUBDIR="source"
@@ -200,44 +199,45 @@ spec:
200199
git checkout $PULL_PULL_SHA
201200
echo "checked out revision: $PULL_PULL_SHA to dir: $SUBDIR"
202201
workingDir: /workspace
203-
- image: gcr.io/jenkinsxio/jx-boot:3.1.62
202+
- computeResources: {}
203+
image: gcr.io/jenkinsxio/jx-boot:3.1.62
204204
name: git-merge
205-
resources: {}
206205
script: |
207206
#!/usr/bin/env sh
208207
jx gitops git merge variables
209208
workingDir: /workspace/source
210-
- image: gcr.io/jenkinsxio/jx-boot:3.1.155
209+
- computeResources: {}
210+
image: gcr.io/jenkinsxio/jx-boot:3.1.155
211211
name: jx-variables
212-
resources: {}
213212
script: |
214213
#!/usr/bin/env sh
215214
jx gitops variables
216-
- image: node:12-slim
215+
- computeResources: {}
216+
image: node:12-slim
217217
name: build-npm-install
218-
resources: {}
219218
script: |
220219
#!/bin/sh
221220
npm install
222-
- image: node:12-slim
221+
- computeResources: {}
222+
image: node:12-slim
223223
name: build-npm-test
224-
resources: {}
225224
script: |
226225
#!/bin/sh
227226
CI=true DISPLAY=:99 npm test
228-
- image: gcr.io/kaniko-project/executor:debug-v1.3.0
227+
- computeResources: {}
228+
image: gcr.io/kaniko-project/executor:debug-v1.3.0
229229
name: build-container-build
230-
resources: {}
231230
script: |
232231
#!/busybox/sh
233232
source .jx/variables.sh
234233
cp /tekton/creds-secrets/tekton-container-registry-auth/.dockerconfigjson /kaniko/.docker/config.json
235234
/kaniko/executor $KANIKO_FLAGS --context=/workspace/source --dockerfile=Dockerfile --destination=$DOCKER_REGISTRY/$DOCKER_REGISTRY_ORG/$APP_NAME:$VERSION
236-
- image: gcr.io/jenkinsxio/jx-preview:0.0.143
235+
- computeResources: {}
236+
image: gcr.io/jenkinsxio/jx-preview:0.0.143
237237
name: promote-jx-preview
238-
resources: {}
239238
script: |
240239
#!/usr/bin/env sh
241240
source .jx/variables.sh
242241
jx preview create
242+
taskRunTemplate: {}
243243
status: {}

0 commit comments

Comments
 (0)