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

Converge local and cloud gorelease scripts, improve release notes #4537

Merged
merged 3 commits into from Mar 28, 2022

Conversation

KnVerey
Copy link
Contributor

@KnVerey KnVerey commented Mar 25, 2022

Re: new release note format

Hopefully this will save us some effort manually identifying PRs! Example:

#4424: Allow setting every array element in replacements
#4497: Fix 3812; Error message changed and check for MalformedYamlError
#4467: fn framework: Enable validation using openAPI schema for functionConfig
#4421: retain quotes in namespace transformer filter
#4383: Fix error during expansion of `!!merge <<:` anchor tags

Re: cloudbuild.sh/localbuild.sh consolidation

The diff of cloudbuild.sh and localbuild.sh on master is:

2a3,4
> # Works exactly like cloudbuild.sh but doesn't perform a release.
> #
5c7
< #  releasing/cloudbuild.sh TAG [--snapshot]
---
> #  releasing/localbuild.sh TAG [--snapshot]
14,17c16
< # Cloud build should be configured to trigger on tags
< # matching:
< #
< #   [\w/]+/v\d+\.\d+\.\d+
---
> # This script runs a build through goreleaser (http://goreleaser.com) but nothing else.
19,20d17
< # This script runs goreleaser (http://goreleaser.com),
< # presumably from a cloudbuild.yaml step that installed it.
122c119
< time /usr/local/bin/goreleaser release \
---
> time /usr/local/bin/goreleaser build \
127d123
<   --release-notes=$changeLogFile \

i.e. the only differences are release vs build and the inclusion of the release notes flag.

@k8s-ci-robot
Copy link
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Mar 25, 2022
@@ -141,7 +141,7 @@ go mod edit -require=sigs.k8s.io/kustomize/kyaml@$versionKyaml plugin/builtin/pa

Create the PR:
```
createBranch pinToKyaml "Pin to kyaml $versionKyaml"
createBranch pinToKyaml "Update kyaml to $versionKyaml"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We have always been removing these from the release notes, but these are obviously key dependencies, and it could be helpful to show them explicitly so folks can cross-reference the release notes if needed.

@KnVerey KnVerey marked this pull request as ready for review March 25, 2022 22:53
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 25, 2022
@KnVerey KnVerey force-pushed the release-updates branch 2 times, most recently from a8a86fd to 9b8bc00 Compare March 28, 2022 16:52
@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 Mar 28, 2022

Visit the [release page] and edit the release notes as desired.
You can test the release script locally by running [cloudbuild.sh](cloudbuild.sh) in a container or by installing Cloud Build Local and running [cloudbuild-local.sh](cloudbuild-local.sh). See each of those files for more details on their usage.
Copy link
Contributor

Choose a reason for hiding this comment

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

I tried this, but I couldn't figure out how to set the value of $TAG_NAME. Regardless, it seemed to be running the steps correctly and threw the exact error I expected given an empty $TAG_NAME so I think it does work.

EDIT: This comment refers to cloudbuild-local.sh specifically.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should just be the first arg, e.g. ./releasing/cloudbuild-local.sh kyaml/v0.13.4

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah thanks! I missed the comment at the top of cloudbuild-local.sh.

Now I get the output:

ERROR: build step 3 "goreleaser/goreleaser:v0.179.0" failed: Failed to decrypt "GITHUB_TOKEN" using key "projects/k8s-staging-kustomize/locations/global/keyRings/kust-cloud-key-ring/cryptoKeys/kust-cloud-key-name": googleapi: Error 403: Permission 'cloudkms.cryptoKeyVersions.useToDecrypt' denied on resource 'projects/k8s-staging-kustomize/locations/global/keyRings/kust-cloud-key-ring/cryptoKeys/kust-cloud-key-name' (or it may not exist)., forbidden

which I assume is because I don't have keyring decryption permissions on the google cloud project (as expected), so this LGTM.

# Cloud build should be configured to trigger on tags
# matching:
# # Run this script in the container, where $TAG is the tag to "release" (e.g. kyaml/v0.13.4)
# ./releasing/cloudbuild.sh $TAG --snapshot
Copy link
Contributor

Choose a reason for hiding this comment

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

Question, I did this with ./releasing/cloudbuild.sh kyaml/v0.13.4 --snapshot, and the output has a bunch of things related to the kustomize module, e.g.

   • parsing tag      
         • DEPRECATED: 'kustomize/v4.5.3' is not SemVer-compatible and may cause other issues in the pipeline, check https://goreleaser.com/deprecations#skipping-semver-validations for more info

and

      • github/gitlab/gitea releases
         • pre-release for tag kustomize/v4.5.3 set to false

is that expected? I would have expected it to only have output related to the kyaml module.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Surprising indeed, though not a new problem with the script. I discovered and added the GORELEASER_CURRENT_TAG env var to fix this.

# kustomize/v1.2.3
# cmd/config/v1.2.3
# ... etc.
#
Copy link
Contributor

Choose a reason for hiding this comment

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

This one worked for me!

#
# Usage (from top of repo):
#
# releasing/localbuild.sh TAG [--snapshot]
# releasing/run-goreleaser.sh TAG MODE[build|release] [--snapshot]
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Both resolved by L31 below

@k8s-ci-robot
Copy link
Contributor

@KnVerey: This PR has multiple commits, and the default merge method is: merge.
You can request commits to be squashed using the label: tide/merge-method-squash

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 size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Mar 28, 2022
@@ -27,7 +27,7 @@ cp releasing/cloudbuild.yaml $config
# Add the --snapshot flag to suppress the
# github release and leave the build output
# in the kustomize/dist directory.
sed -i "s|# - '--snapshot|- '--snapshot|" $config
sed -i "" "s|# - '--snapshot|- '--snapshot|" $config
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a linux vs mac sed difference. Both active maintainers currently use macs.

args:
- 'cp'
- '$(go env GOROOT)/bin/go'
- '/workspace/bin/'
Copy link
Contributor

Choose a reason for hiding this comment

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

Getting this error

$ ./releasing/cloudbuild-local.sh kyaml/v0.13.4
...
Step #3: cp: can't stat '$(go env GOROOT)/bin/go': No such file or directory

@natasha41575
Copy link
Contributor

/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 Mar 28, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: KnVerey, natasha41575

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:
  • OWNERS [KnVerey,natasha41575]

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

@k8s-ci-robot k8s-ci-robot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. and removed do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. labels Mar 28, 2022
@natasha41575
Copy link
Contributor

/hold

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 28, 2022
@natasha41575 natasha41575 removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 28, 2022
@natasha41575 natasha41575 merged commit 485f7d4 into kubernetes-sigs:master Mar 28, 2022
@KnVerey KnVerey mentioned this pull request Jul 12, 2022
6 tasks
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. 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. 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.

None yet

3 participants