Skip to content
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

Merged
merged 4 commits into from
Jan 17, 2024

Conversation

l-qing
Copy link

@l-qing l-qing commented Jan 17, 2024

Changes

Submitter Checklist

As the author of this PR, please check off the items in this checklist:

  • Has Docs if any changes are user facing, including updates to minimum requirements e.g. Kubernetes version bumps
  • Has Tests included if any functionality added or changed
  • Follows the commit message standard
  • Meets the Tekton contributor standards (including functionality, content, code)
  • Has a kind label. You can add one by adding a comment on this PR that contains /kind <type>. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tep
  • Release notes block below has been updated with any user facing changes (API changes, bug fixes, changes requiring upgrade notices or deprecation warnings). See some examples of good release notes.
  • Release notes contains the string "action required" if the change requires additional action from users switching to the new release

@l-qing l-qing force-pushed the feat/adapt-for-tekton-0.55 branch from 7a0a509 to d231cef Compare January 17, 2024 09:50
workspaces:
- name: source
- name: source-tkn
- name: source-git-init
Copy link
Author

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
Copy link
Author

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"`
Copy link
Author

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.
Copy link
Author

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 {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

等我们完全移除了凭据中的 该 annotations 后,就不需要定制这部分内容了。
原来 @yuzp1996 的 PR:#1

tpl.Env = defaultTpl.Env
}
tpl.Env = mergeByName(defaultTpl.Env, tpl.Env)
tpl.Volumes = mergeByName(defaultTpl.Volumes, tpl.Volumes)
Copy link
Author

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."),
Copy link
Author

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 {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

原来定制的 PR:#65

目前还是先 copy 下注释,后面有时间了可以适配到社区的新字段中。

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR 链接是否可以放到代码中注释?

Copy link
Author

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 {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个是还原了 v0.41.0 中的函数,让我们依赖的组件能成功编译。
后续还是需要看社区变动(移除)的原因,然后调整我们自己的代码。

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

加个 TODO?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

暂时不加了。
等我马上开始做 持续构建的适配时,就会深入研究这部分代码,看之前社区为什么移除,我们是否可以切换到新的方法上。
之前只是为了编译通过,先把函数给加回来了。

Copy link

@danielfbm danielfbm left a 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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@l-qing l-qing merged commit 30ab5aa into alauda/release-v0.55.x Jan 17, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants