-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: adapt for tekton 0.55 #83
Conversation
revert some changes from tektoncd#6445
revert some changes from tektoncd#6650
7a0a509
to
d231cef
Compare
workspaces: | ||
- name: source | ||
- name: source-tkn | ||
- name: source-git-init |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
新增了 git-init 和 tkn 的镜像构建。
默认的 tkn 存在安全漏洞,git-init 被移出了 pipeline 代码仓库。
现在单独构建后,就避免了安全问题。
@@ -7,7 +7,7 @@ require ( | |||
github.com/ahmetb/gen-crd-api-reference-docs v0.3.1-0.20220720053627-e327d0730470 // Waiting for https://github.com/ahmetb/gen-crd-api-reference-docs/pull/43/files to merge | |||
github.com/cloudevents/sdk-go/v2 v2.14.0 | |||
github.com/containerd/containerd v1.7.8 | |||
github.com/go-git/go-git/v5 v5.10.0 | |||
github.com/go-git/go-git/v5 v5.11.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
修复安全问题。
@@ -140,7 +140,6 @@ type Step struct { | |||
Ref *Ref `json:"ref,omitempty"` | |||
// Params declares parameters passed to this step action. | |||
// +optional | |||
// +listType=atomic | |||
Params Params `json:"params,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
改了后,controller-gen 生成 crds 时才不报错。
社区没有这个问题是他们的 crds 都是精简版的,可能并没有用 controller-gen 来生成。
@@ -482,11 +484,11 @@ var AllParamTypes = []ParamType{ParamTypeString, ParamTypeArray, ParamTypeObject | |||
// Used in JSON unmarshalling so that a single JSON field can accept | |||
// either an individual string or an array of strings. | |||
type ParamValue struct { | |||
Type ParamType // Represents the stored type of ParamValues. | |||
StringVal string | |||
Type ParamType `json:"type"` // Represents the stored type of ParamValues. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
社区在这个 PR 中移除了 json 的 tag,他们给出了解释。但我们生成 crds 还是需要该 tag,所以加回来了。
tektoncd#6445
@@ -76,10 +76,6 @@ func (dc *basicDocker) Set(value string) error { | |||
secret := parts[0] | |||
url := parts[1] | |||
|
|||
if _, ok := dc.Entries[url]; ok { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tpl.Env = defaultTpl.Env | ||
} | ||
tpl.Env = mergeByName(defaultTpl.Env, tpl.Env) | ||
tpl.Volumes = mergeByName(defaultTpl.Volumes, tpl.Volumes) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
等更新到社区的 v0.56.0 后,这部分就不需要了。
变动已经在该 PR 中合并了:tektoncd#7552
// }, | ||
// }, | ||
// }, | ||
// wantErr: fmt.Errorf("unexpected error in ExtractVariablesFromString: Invalid referencing of parameters in \"$(params.p1.aaa.bbb)\"! Only two dot-separated components after the prefix \"params\" are allowed."), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
因为调整了 substitution 中的限制,所以这个 case 不通过了。这个目前看只影响了 enum 枚举类型的校验。
@@ -80,6 +82,15 @@ func (resolver *Resolver) Get(ctx context.Context, _, _ string) (runtime.Object, | |||
if err != nil { | |||
return nil, nil, &InvalidRuntimeObjectError{original: err} | |||
} | |||
|
|||
// Copy annotations from the resolved resource to the runtime object. | |||
if new, ok := obj.(metav1.Object); ok { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
原来定制的 PR:#65
目前还是先 copy 下注释,后面有时间了可以适配到社区的新字段中。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR 链接是否可以放到代码中注释?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
准备在 gitlab 中代码仓库的 readme 中添加详细的变更项,以及对应的 PR。所以没准备在代码中添加这种注释。
@@ -48,6 +48,111 @@ var paramIndexingRegex = regexp.MustCompile(paramIndexing) | |||
// intIndexRegex will match all `[int]` for param expression | |||
var intIndexRegex = regexp.MustCompile(intIndex) | |||
|
|||
// ValidateVariable makes sure all variables in the provided string are known | |||
func ValidateVariable(name, value, prefix, locationName, path string, vars sets.String) *apis.FieldError { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个是还原了 v0.41.0 中的函数,让我们依赖的组件能成功编译。
后续还是需要看社区变动(移除)的原因,然后调整我们自己的代码。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
加个 TODO?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
暂时不加了。
等我马上开始做 持续构建的适配时,就会深入研究这部分代码,看之前社区为什么移除,我们是否可以切换到新的方法上。
之前只是为了编译通过,先把函数给加回来了。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
看到了有几个单元测试 被 comment 掉的,不会是我们的改动导致质量问题的话就OK哈
@@ -0,0 +1,19 @@ | |||
# if you want disabled the DTD verification for a proxy problem for example, true by default | |||
sonar.projectKey=github.com-tektoncd-pipeline.git |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Changes
Submitter Checklist
As the author of this PR, please check off the items in this checklist:
/kind <type>
. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tep