如何从TFS中提取源代码以在openshift管道中构建图像

问题描述 投票:0回答:1

我创建了一个 openshift 管道,如下所示:

- name: fetch-repository
  taskRef:
    kind: ClusterTask
    name: git-clone
  params:
    - name: URL
      value: $(params.git-url)
    - name: subdirectory
      value: ''
    - name: deleteExisting
      value: 'true'
    - name: revision
      value: $(params.git-revision)
    - name: sslVerify
      value: 'false'  # Disable SSL verification (temporary)
    - name: username
      valueFrom:
       secretKeyRef:
         name: git-secret
         key: username
    - name: password
      valueFrom:
       secretKeyRef:
         name: git-secret
         key: password
  workspaces:
    - name: output
      workspace: shared-workspace

还创建了一个秘密如下

apiVersion: v1
kind: Secret
metadata:
  name: git-secret
  namespace: bupa-ceasar-standalone
type: kubernetes.io/basic-auth
stringData:
  username: username
  password: password

但是在 openshift 管道中保存 yaml 时,它显示 valueFrom 是一个未知字段

An error occurred
admission webhook "webhook.pipeline.tekton.dev" denied the request: mutation failed: cannot decode incoming new object: json: unknown field "valueFrom"

还有其他可能从 TFS 提取源代码吗?

kubernetes tfs openshift
1个回答
0
投票

查看文档指定参数,指定参数时貌似不支持

valueFrom
字段。

valueFrom
字段可以在环境源中使用。您可以参考使用 Secret 作为环境源中的示例。

样品:

env:
- name: GIT_USERNAME
  valueFrom:
    secretKeyRef:
      name: git-secret
      key: username
- name: GIT_PASSWORD
  valueFrom:
    secretKeyRef:
      name: git-secret
      key: password
© www.soinside.com 2019 - 2024. All rights reserved.