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

Start go build and release tooling #8935

Open
wants to merge 20 commits into
base: master
Choose a base branch
from

Conversation

radTuti
Copy link
Contributor

@radTuti radTuti commented Jun 22, 2024

Description

This is the core base of the go release tooling that will replace useage of Makefile and hack/release for a more cohesive process. It tries to adhere to standard go project layout

The borrows from the town in Bob the Builder: Ready Steady Build

Related issues/PRs

N/A

Todos

  • Tests
  • Documentation
  • Release note

Release Note

I'm going to go with not required atm until it gets intergrated

TBD

Reminder for the reviewer

Make sure that this PR has the correct labels and milestone set.

Every PR needs one docs-* label.

  • docs-pr-required: This change requires a change to the documentation that has not been completed yet.
  • docs-completed: This change has all necessary documentation completed.
  • docs-not-required: This change has no user-facing impact and requires no docs.

Every PR needs one release-note-* label.

  • release-note-required: This PR has user-facing changes. Most PRs should have this label.
  • release-note-not-required: This PR has no user-facing changes.

Other optional labels:

  • cherry-pick-candidate: This PR should be cherry-picked to an earlier release. For bug fixes only.
  • needs-operator-pr: This PR is related to install and requires a corresponding change to the operator.

- split DockerGoBuild to allow better reusability
- reorganize file structure to adhere to gostandards
- update reusable goyek section + rename
@radTuti radTuti added docs-not-required Docs not required for this change release-note-not-required Change has no user-facing impact labels Jun 22, 2024
@radTuti radTuti requested a review from a team as a code owner June 22, 2024 00:30
@marvin-tigera marvin-tigera added this to the Calico v3.29.0 milestone Jun 22, 2024
@@ -0,0 +1,44 @@
module github.com/projectcalico/fixham
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 probably want to use the same go.mod / go.sum as the root of the project here? Is there a reason you have in mind not to?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixham is a separate module that can be use on its own similar to api

Copy link
Member

Choose a reason for hiding this comment

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

I believe since we're narrowing in on release logic, we don't need to treat fixham as a library to be imported, rather it's a CLI tool that will orchestrate the release. So with that in mind, I think it will be better to use the existing go.mod / go.sum from the repository root.

fixham/pkg/bootstrap/bootstrap.go Outdated Show resolved Hide resolved
fixham/pkg/bootstrap/bootstrap.go Outdated Show resolved Hide resolved
fixham/pkg/bootstrap/bootstrap.go Outdated Show resolved Hide resolved
fixham/pkg/bootstrap/bootstrap.go Outdated Show resolved Hide resolved
fixham/pkg/bootstrap/test.go Outdated Show resolved Hide resolved
fixham/pkg/bootstrap/bootstrap.go Outdated Show resolved Hide resolved
fixham/build/main.go Outdated Show resolved Hide resolved
fixham/internal/client/client.go Outdated Show resolved Hide resolved
fixham/internal/client/client.go Outdated Show resolved Hide resolved
@radTuti radTuti force-pushed the go-release-pkg branch 4 times, most recently from 40970c2 to ea3550f Compare June 25, 2024 05:08
@radTuti radTuti force-pushed the go-release-pkg branch 3 times, most recently from 26a358c to cb7b9aa Compare June 25, 2024 11:33
@radTuti radTuti requested a review from hjiawei June 25, 2024 18:07
return types.ContainerExecInspect{}, err
}

logrus.WithField("cmd", cmd).Print("printing output...\n", string(output), "\n...end of output")
Copy link
Member

Choose a reason for hiding this comment

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

Probably want to use logrus.WithField().Infof

tasks map[string]*goyek.DefinedTask
}

// NewBuilder returns a new Component
Copy link
Member

Choose a reason for hiding this comment

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

I don't see a type Component anywhere - this comment is probably wrong.

@@ -22,6 +22,8 @@ UBI_VERSION=8.10
# Configuration for Semaphore integration.
ORGANIZATION = projectcalico

export REPO_ROOT := $(shell git rev-parse --show-toplevel)
Copy link
Member

Choose a reason for hiding this comment

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

We shouldn't need this. The fixham Makefile should just import both lib.Makefile and metadata.mk and then export the variables that it needs itself.

Same for the GO_BUILD_VER above.

@@ -1,44 +0,0 @@
#!/bin/bash
Copy link
Member

Choose a reason for hiding this comment

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

Is removing this related to fixham at all? Is this just unused code?

@@ -1,3 +1,4 @@
NAME = projectcalico
Copy link
Member

Choose a reason for hiding this comment

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

What is "NAME"?

This seems more like "ORGANIZATION", which is already defined in metadata.mk

.PHONY: default
default: fixham

.PHONY: bin/fixham
Copy link
Member

Choose a reason for hiding this comment

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

bin/fixham isn't a PHONY target. PHONY should only be used on targets that don't actually produce a file, whereas bin/fixham does produce the file bin/fixham.

fixham: bin/fixham
@bin/fixham $(ARGS)

.PHONY: %
Copy link
Member

Choose a reason for hiding this comment

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

This seems unnecessary to me

@@ -0,0 +1,22 @@
include ../metadata.mk

export NAME = fixham
Copy link
Member

Choose a reason for hiding this comment

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

These shouldn't be exported. If you want to use them in a target, you should pass them as environment variables to the commands in that target.

Organization string `envconfig:"ORGANIZATION"`
// GoBuildImageName is the name of the go-build image
// if wanting to override calico/go-build
GoBuildImageName string `envconfig:"GO_BUILD_IMAGE" default:"calico/go-build"`
Copy link
Member

Choose a reason for hiding this comment

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

This is a nit, but these should have newlines before any commends for readability. e.g.,

	Name         string `envconfig:"NAME"`
	PackageName  string `envconfig:"PACKAGE_NAME" required:"true"`
	Organization string `envconfig:"ORGANIZATION"`

	// GoBuildImageName is the name of the go-build image
	// if wanting to override calico/go-build
	GoBuildImageName string `envconfig:"GO_BUILD_IMAGE" default:"calico/go-build"`

	// GoBuildVersion is the version of the go-build image
	GoBuildVersion string `envconfig:"GO_BUILD_VER" required:"true"`

@@ -0,0 +1,44 @@
module github.com/projectcalico/fixham
Copy link
Member

Choose a reason for hiding this comment

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

I believe since we're narrowing in on release logic, we don't need to treat fixham as a library to be imported, rather it's a CLI tool that will orchestrate the release. So with that in mind, I think it will be better to use the existing go.mod / go.sum from the repository root.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs-not-required Docs not required for this change release-note-not-required Change has no user-facing impact
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants