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

Onboarding consul-dataplane to VBA (version bump automation) #296

Open
wants to merge 4 commits into
base: main
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
4 changes: 1 addition & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ jobs:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: get product version
id: get-product-version
run: |
make version
echo "product-version=$(make version)" >> $GITHUB_OUTPUT
uses: hashicorp/actions-set-product-version@v1

generate-metadata-file:
needs: get-product-version
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/create-release-branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: create a release branch
on: [workflow_dispatch]
jobs:
create-branch:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: hashicorp/actions-create-release-branch@v1
with:
token: ${{ secrets.ELEVATED_GITHUB_TOKEN }}
9 changes: 9 additions & 0 deletions .release/ci.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,12 @@ event "promote-production-packaging" {
on = "always"
}
}

event "bump-version" {
depends = ["promote-production-packaging"]
action "bump-version" {
organization = "hashicorp"
repository = "crt-workflows-common"
workflow = "bump-version"
}
Copy link
Contributor

Choose a reason for hiding this comment

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

question: Do we need the notification here also or does that automatically happen?

   notification {
     on = "fail"
   }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

By default, notifications will be sent on failure without this block. If you'd like to get notifications on success also, you can add:

   notification {
     on = "always"
   }

}
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ PLATFORM = $(OS)/$(ARCH)
DIST = dist/$(PLATFORM)
BIN = $(DIST)/$(BIN_NAME)

VERSION = $(shell ./build-scripts/version.sh pkg/version/version.go)
VERSION = $(shell ./build-scripts/version.sh version/VERSION)

GIT_COMMIT?=$(shell git rev-parse --short HEAD)
GIT_DIRTY?=$(shell test -n "`git status --porcelain`" && echo "+CHANGES" || true)
Expand Down
4 changes: 2 additions & 2 deletions build-scripts/version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@


version_file=$1
version=$(awk '$1 == "Version" && $2 == "=" { gsub(/"/, "", $3); print $3 }' < "${version_file}")
prerelease=$(awk '$1 == "VersionPrerelease" && $2 == "=" { gsub(/"/, "", $3); print $3 }' < "${version_file}")
version=$(awk -F- '{ print $1 }' < "${version_file}")
prerelease=$(awk -F- '{ print $2 }' < "${version_file}")

if [ -n "$prerelease" ]; then
echo "${version}-${prerelease}"
Expand Down
2 changes: 1 addition & 1 deletion cmd/consul-dataplane/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ import (
"context"
"flag"
"fmt"
"github.com/hashicorp/consul-dataplane/version"
"log"
"os"
"os/signal"
"strings"
"syscall"

"github.com/hashicorp/consul-dataplane/pkg/consuldp"
"github.com/hashicorp/consul-dataplane/pkg/version"
)

var (
Expand Down
1 change: 1 addition & 0 deletions version/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.3.0-dev
File renamed without changes.
File renamed without changes.
14 changes: 6 additions & 8 deletions pkg/version/version.go → version/version.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package version

import (
_ "embed"
"fmt"
"strings"
)
Expand All @@ -14,15 +12,15 @@ var (
GitCommit string

// The main version number that is being run at the moment.
//
// Version must conform to the format expected by github.com/hashicorp/go-version
// for tests to work.
Version = "1.3.0"

// A pre-release marker for the version. If this is "" (empty string)
// VersionPrerelease is a pre-release marker for the version. If this is "" (empty string)
// then it means that it is a final release. Otherwise, this is a pre-release
// such as "dev" (in development), "beta", "rc1", etc.
VersionPrerelease = "dev"
// Version and VersionPrerelease info are now being embedded directly from the VERSION file.
//go:embed VERSION
fullVersion string
Version, VersionPrerelease, _ = strings.Cut(strings.TrimSpace(fullVersion), "-")
)

// GetHumanVersion composes the parts of the version in a way that's suitable
Expand Down
Loading