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

build(deps): bump github.com/go-errors/errors from 1.4.2 to 1.5.1 in /cmd/config #10

Open
wants to merge 8 commits into
base: feat/5449-add-release-automation
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions .github/workflows/release-api.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: release-api

on:
workflow_dispatch:
inputs:
release_type:
type: choice
description: release type (major, minor, or patch).
options:
- major
- minor
- patch
required: true
release_branch:
type: string
description: release branch name "release-api-v*"
required: true

jobs:
pre-build:
name: Pre-build
runs-on: ubuntu-latest
steps:
- name: Checkout to release branch
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ inputs.release_branch }}
- name: Unit test
id: unit_test
run: |
echo "Executing unit test"
make test-unit-all >> "${GITHUB_OUTPUT}"
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Pin kyaml, cmd/config
run: |
gorepomod pin kyaml --doIt
gorepomod pin cmd/config --doIt
- name: Build api
uses: actions/checkout@v4
with:
fetch-depth: 0
e2e-test:
name: End-to-end Testing
runs-on: ubuntu-latest
steps:
- name: End-to-end testing
id: e2e_test
run: make verify-kustomize-e2e
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Release kyaml
run: |
make install-local-tools
gorepomod release kyaml ${{ inputs.release_type }} --doIt
58 changes: 58 additions & 0 deletions .github/workflows/release-cmd-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: release-cmd-config

on:
workflow_dispatch:
inputs:
release_type:
type: choice
description: release type (major, minor, or patch).
options:
- major
- minor
- patch
required: true
release_branch:
type: string
description: release branch name "release-cmd/config-v*"
required: true

jobs:
pre-build:
name: Pre-build
runs-on: ubuntu-latest
steps:
- name: Fetch changes
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ inputs.release_branch }}
- name: Unit test
id: unit_test
run: |
echo "Executing unit test"
make test-unit-all >> "${GITHUB_OUTPUT}"
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Pin kyaml
run: |
gorepomod pin kyaml --doIt
- name: Build test
run: |
make install-local-tools
make build-kustomize-api
e2e-test:
name: End-to-end Testing
runs-on: ubuntu-latest
steps:
- name: End-to-end testing
run: make verify-kustomize-e2e
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Release cmd/config
run: |
make install-local-tools
gorepomod release cmd/config ${{ inputs.release_type }} --doIt
61 changes: 61 additions & 0 deletions .github/workflows/release-kustomize.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: release-kustomize

on:
workflow_dispatch:
inputs:
release_type:
type: choice
description: release type (major, minor, or patch).
options:
- major
- minor
- patch
required: true
release_branch:
type: string
description: release branch name "release-kustomize-v*"
required: true

jobs:
pre-build:
name: Pre-build
runs-on: ubuntu-latest
steps:
- name: Fetch changes
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ inputs.release_branch }}
- name: Unit test
id: unit_test
run: |
echo "Executing unit test"
make test-unit-all >> "${GITHUB_OUTPUT}"
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Pin kyaml, cmd/config, and api
run: |
gorepomod pin kyaml --doIt
gorepomod pin cmd/config --doIt
gorepomod pin api --doIt
- name: Build test
run: |
make install-local-tools
make build-kustomize-api
e2e-test:
name: End-to-end Testing
runs-on: ubuntu-latest
steps:
- name: End-to-end testing
id: e2e_test
run: make verify-kustomize-e2e
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Release kyaml
run: |
make install-local-tools
gorepomod release kustomize ${{ inputs.release_type }} --doIt
57 changes: 57 additions & 0 deletions .github/workflows/release-kyaml.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: release-kyaml

on:
workflow_dispatch:
inputs:
release_type:
type: choice
description: release type (major, minor, or patch).
options:
- major
- minor
- patch
required: true
release_branch:
type: string
description: release branch name "release-kyaml-v*"
required: true

jobs:
pre-build:
name: Pre-build
runs-on: ubuntu-latest
outputs:
unit_test_result: ${{ steps.unit_test.outputs }}
steps:
- name: Fetch changes
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ inputs.release_branch }}
- name: Unit test
id: unit_test
run: |
echo "Executing unit test"
make test-unit-all >> "${GITHUB_OUTPUT}"
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Build test
run: |
make install-local-tools
make build-kustomize-api
e2e-test:
name: End-to-end Testing
runs-on: ubuntu-latest
steps:
- name: End-to-end testing
run: make verify-kustomize-e2e
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Release kyaml
run: |
make install-local-tools
gorepomod release kyaml ${{ inputs.release_type }}
2 changes: 1 addition & 1 deletion cmd/config/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module sigs.k8s.io/kustomize/cmd/config
go 1.20

require (
github.com/go-errors/errors v1.4.2
github.com/go-errors/errors v1.5.1
github.com/spf13/cobra v1.7.0
github.com/stretchr/testify v1.8.1
gopkg.in/inf.v0 v0.9.1
Expand Down
4 changes: 2 additions & 2 deletions cmd/config/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA=
github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og=
github.com/go-errors/errors v1.5.1 h1:ZwEMSLRCapFLflTpT7NKaAc7ukJ8ZPEjzlxt8rPN8bk=
github.com/go-errors/errors v1.5.1/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og=
github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE=
github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs=
github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE=
Expand Down
27 changes: 25 additions & 2 deletions releasing/create-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,29 @@ set -o errexit
set -o nounset
set -o pipefail

declare -a RELEASE_TYPES=("major" "minor" "patch")

if [[ -z "${1-}" ]]; then
echo "Usage: $0 TAG"
echo " TAG: the tag to build or release, e.g. api/v1.2.3"
exit 1
fi

if [[ -z "${2-}" ]]; then
echo "Release type not specified, using default value: patch"
release_type="patch"
elif [[ ! "${RELEASE_TYPES[*]}" =~ "${2}" ]]; then
echo "Unsupported release type, only input these values: major, minor, patch."
exit 1
fi

git_tag=$1
release_type=$2
release_branch="release-${git_tag}"

echo "release tag: $git_tag"
echo "release type: $release_type"
echo "release branch: $release_branch"

# Build the release binaries for every OS/arch combination.
# It builds compressed artifacts on $release_dir.
Expand Down Expand Up @@ -81,6 +96,8 @@ function build_kustomize_binary {
}

function create_release {
source ./releasing/helpers.sh

git_tag=$1

# Take everything before the last slash.
Expand All @@ -90,13 +107,20 @@ function create_release {
# Take everything after the last slash.
version=${git_tag##*/}

# Create release branch release-{module}/{version}
echo "Creating release..."
createBranch $release_branch "create release branch $release_branch"

# Generate the changelog for this release
# using the last two tags for the module
changelog_file=$(mktemp)
./releasing/compile-changelog.sh "$module" "$git_tag" "$changelog_file"
./releasing/compile-changelog.sh "$module" "HEAD" "$changelog_file"

additional_release_artifacts_arg=""

# Trigger workflow for respective modeule release
gh workflow run "release-${module}.yml" -f "release_type=${release_type}" -f "release_branch=${release_branch}"

# build `kustomize` binary
if [[ "$module" == "kustomize" ]]; then
release_artifact_dir=$(mktemp -d)
Expand All @@ -122,6 +146,5 @@ function create_release {
--notes-file "$changelog_file"
}


## create release
create_release "$git_tag"
10 changes: 9 additions & 1 deletion releasing/helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,20 @@
# Copyright 2022 The Kubernetes Authors.
# SPDX-License-Identifier: Apache-2.0

ORIGIN_MASTER="feat/5449-add-release-automation"
UPSTREAM_REPO="upstream"
UPSTREAM_MASTER="master"

function createBranch {
branch=$1
title=$2
echo "Making branch $branch : \"$title\""
git branch -D $branch # delete if it exists
# Check if release branch exists
if git show-ref --quiet "refs/heads/${branch}"; then
git fetch --tags upstream master
git checkout $ORIGIN_MASTER
git branch -D $branch # delete if it exists
fi
git checkout -b $branch
git commit -a -m "$title"
git push -f origin $branch
Expand Down