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

Create kubepkg tool to building debs/rpms #935

Merged
merged 12 commits into from
Jan 3, 2020

Conversation

justaugustus
Copy link
Member

@justaugustus justaugustus commented Nov 16, 2019

Refactors the debs builder into a package builder which will eventually build both debs/rpms.
This PR only attempts to convert the deb builder into a CLI tool that looks closer to how krel is structured and boost the test coverage a little.

rpm building will be handled in a separate PR once we think a little more about how the final tool should be shaped.

For reviewers: I'm explicitly punting on testing the following functions/methods, as they will likely be massively refactored or removed in a follow-up (and this code is not currently is use):

  • ConstructBuilds
  • WalkBuilds
  • buildPackage
  • (c cfg) run()

ref: #918
cc: @kubernetes/release-engineering

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. do-not-merge/blocked-paths Indicates that a PR should not merge because it touches files in blocked paths. labels Nov 16, 2019
@k8s-ci-robot
Copy link
Contributor

@justaugustus: Adding label: do-not-merge/blocked-paths because PR changes a protected file.

Reasons for blocking this PR:

[Changes to certain release tools can affect our ability to test, build, and release Kubernetes. This PR must be explicitly approved by SIG Release repo admins.]

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. area/release-eng Issues or PRs related to the Release Engineering subproject sig/release Categorizes an issue or PR as relevant to SIG Release. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 16, 2019
@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 16, 2019
@feiskyer
Copy link
Member

Cool. Are we able to extend this to subprojects, e.g. cri-tools?

@justaugustus
Copy link
Member Author

@feiskyer --

Cool. Are we able to extend this to subprojects, e.g. cri-tools?

Yep! You'll actually be able to this today on the debs side with:

kubepkg debs --packages cri-tools --cri-tools-version 1.16.1

...and the output is as follows:

$ ls -lah bin/*
bin/nightly:
total 48M
drwxr-xr-x 2 augustus augustus 4.0K Nov 16 14:11 .
drwxr-xr-x 5 augustus augustus 4.0K Nov 15 23:31 ..
-rw-r--r-- 1 augustus augustus  11M Nov 16 14:09 cri-tools_1.16.1-0_amd64.deb
-rw-r--r-- 1 augustus augustus 9.2M Nov 16 14:10 cri-tools_1.16.1-0_arm64.deb
-rw-r--r-- 1 augustus augustus 9.2M Nov 16 14:09 cri-tools_1.16.1-0_armhf.deb
-rw-r--r-- 1 augustus augustus 9.1M Nov 16 14:10 cri-tools_1.16.1-0_ppc64el.deb
-rw-r--r-- 1 augustus augustus 9.9M Nov 16 14:11 cri-tools_1.16.1-0_s390x.deb

bin/release:
total 48M
drwxr-xr-x 2 augustus augustus 4.0K Nov 16 14:11 .
drwxr-xr-x 5 augustus augustus 4.0K Nov 15 23:31 ..
-rw-r--r-- 1 augustus augustus  11M Nov 16 14:09 cri-tools_1.16.1-0_amd64.deb
-rw-r--r-- 1 augustus augustus 9.2M Nov 16 14:10 cri-tools_1.16.1-0_arm64.deb
-rw-r--r-- 1 augustus augustus 9.2M Nov 16 14:09 cri-tools_1.16.1-0_armhf.deb
-rw-r--r-- 1 augustus augustus 9.1M Nov 16 14:10 cri-tools_1.16.1-0_ppc64el.deb
-rw-r--r-- 1 augustus augustus 9.9M Nov 16 14:11 cri-tools_1.16.1-0_s390x.deb

bin/testing:
total 48M
drwxr-xr-x 2 augustus augustus 4.0K Nov 16 14:11 .
drwxr-xr-x 5 augustus augustus 4.0K Nov 15 23:31 ..
-rw-r--r-- 1 augustus augustus  11M Nov 16 14:09 cri-tools_1.16.1-0_amd64.deb
-rw-r--r-- 1 augustus augustus 9.2M Nov 16 14:10 cri-tools_1.16.1-0_arm64.deb
-rw-r--r-- 1 augustus augustus 9.2M Nov 16 14:09 cri-tools_1.16.1-0_armhf.deb
-rw-r--r-- 1 augustus augustus 9.1M Nov 16 14:10 cri-tools_1.16.1-0_ppc64el.deb
-rw-r--r-- 1 augustus augustus 9.9M Nov 16 14:11 cri-tools_1.16.1-0_s390x.deb

This is strictly because cri-tools is one of the packages we currently publish through the Release Engineering (kubelet, kubectl, kubeadm, kubernetes-cni, cri-tools).

Eventually, I'd like to get to a place where this tool takes a yaml-based config with package definitions and builds the packages specified, though we won't have time to work on that piece probably until 1.18.

@justaugustus justaugustus removed the do-not-merge/blocked-paths Indicates that a PR should not merge because it touches files in blocked paths. label Nov 16, 2019
@k8s-ci-robot
Copy link
Contributor

@justaugustus: Adding label: do-not-merge/blocked-paths because PR changes a protected file.

Reasons for blocking this PR:

[Changes to certain release tools can affect our ability to test, build, and release Kubernetes. This PR must be explicitly approved by SIG Release repo admins.]

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the do-not-merge/blocked-paths Indicates that a PR should not merge because it touches files in blocked paths. label Nov 23, 2019
builds, err := kpkg.ConstructBuilds(ro.packages, ro.channels, ro.kubeVersion, ro.revision, ro.cniVersion, ro.criToolsVersion)
if err != nil {
log.Fatalf("err: %v", err)
}
Copy link
Member

@cpanato cpanato Nov 24, 2019

Choose a reason for hiding this comment

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

Instead do the log.Fatalf("err: %v", err) is not better log and return the error?

Copy link
Member

Choose a reason for hiding this comment

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

There should be no need to log since we fail errors with logrus.Fatal in any case. Just returning the error should be enough to avoid logging them twice.

@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jan 1, 2020
Signed-off-by: Stephen Augustus <saugustus@vmware.com>
Signed-off-by: Stephen Augustus <saugustus@vmware.com>
Signed-off-by: Stephen Augustus <saugustus@vmware.com>
@k8s-ci-robot k8s-ci-robot added the do-not-merge/blocked-paths Indicates that a PR should not merge because it touches files in blocked paths. label Jan 3, 2020
@k8s-ci-robot
Copy link
Contributor

@justaugustus: Adding label: do-not-merge/blocked-paths because PR changes a protected file.

Reasons for blocking this PR:

[Changes to certain release tools can affect our ability to test, build, and release Kubernetes. This PR must be explicitly approved by SIG Release repo admins.]

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Co-Authored-By: Sascha Grunert <sgrunert@suse.com>
Signed-off-by: Stephen Augustus <saugustus@vmware.com>
@justaugustus justaugustus removed the do-not-merge/blocked-paths Indicates that a PR should not merge because it touches files in blocked paths. label Jan 3, 2020
@justaugustus
Copy link
Member Author

@saschagrunert -- Thanks! I've addressed your feedback, if you have time for another sweep. :)

@k8s-ci-robot k8s-ci-robot added the do-not-merge/blocked-paths Indicates that a PR should not merge because it touches files in blocked paths. label Jan 3, 2020
@k8s-ci-robot
Copy link
Contributor

@justaugustus: Adding label: do-not-merge/blocked-paths because PR changes a protected file.

Reasons for blocking this PR:

[Changes to certain release tools can affect our ability to test, build, and release Kubernetes. This PR must be explicitly approved by SIG Release repo admins.]

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@justaugustus justaugustus removed the do-not-merge/blocked-paths Indicates that a PR should not merge because it touches files in blocked paths. label Jan 3, 2020
Copy link
Member

@saschagrunert saschagrunert left a comment

Choose a reason for hiding this comment

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

Good, found just another three minor nits :)

pkg/kubepkg/kubepkg.go Outdated Show resolved Hide resolved
cmd/kubepkg/cmd/debs.go Outdated Show resolved Hide resolved
ro := rootOpts

// Replace the "+" with a "-" to make it semver-compliant
ro.kubeVersion = strings.TrimPrefix(ro.kubeVersion, "v")
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
ro.kubeVersion = strings.TrimPrefix(ro.kubeVersion, "v")
ro.kubeVersion = git.TrimTagPrefix(ro.kubeVersion)

@k8s-ci-robot k8s-ci-robot added the do-not-merge/blocked-paths Indicates that a PR should not merge because it touches files in blocked paths. label Jan 3, 2020
@k8s-ci-robot
Copy link
Contributor

@justaugustus: Adding label: do-not-merge/blocked-paths because PR changes a protected file.

Reasons for blocking this PR:

[Changes to certain release tools can affect our ability to test, build, and release Kubernetes. This PR must be explicitly approved by SIG Release repo admins.]

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@justaugustus
Copy link
Member Author

@saschagrunert -- Fixed up!

@saschagrunert
Copy link
Member

Cool, thank you!

/retest

Co-Authored-By: Sascha Grunert <sgrunert@suse.com>
Signed-off-by: Stephen Augustus <saugustus@vmware.com>
package cmd

import (
"github.com/sirupsen/logrus"
Copy link
Member

Choose a reason for hiding this comment

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

I think we have to remove this line to fix the build error.

Copy link
Member Author

Choose a reason for hiding this comment

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

@saschagrunert -- Yep! Just fixed it.

Signed-off-by: Stephen Augustus <saugustus@vmware.com>
@saschagrunert
Copy link
Member

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 3, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: justaugustus, saschagrunert

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@justaugustus justaugustus removed the do-not-merge/blocked-paths Indicates that a PR should not merge because it touches files in blocked paths. label Jan 3, 2020
@k8s-ci-robot k8s-ci-robot merged commit b80729d into kubernetes:master Jan 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/release-eng Issues or PRs related to the Release Engineering subproject cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. sig/release Categorizes an issue or PR as relevant to SIG Release. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants