From 9e94f0fec1c8f57b69ca3611da00334e350e3e77 Mon Sep 17 00:00:00 2001 From: Colin Lyons Date: Thu, 29 Dec 2022 03:19:39 +0000 Subject: [PATCH] migrating to a release command. --- .github/workflows/go.yml | 4 ++-- cmd/buidl/main.go | 2 +- cmd/bumper/main.go | 4 ++-- docker/indra/build.go => cmd/docker/release/main.go | 0 docker/indra/Dockerfile | 6 +++--- pkg/docker/builder.go | 10 +++++----- version.go | 2 +- 7 files changed, 14 insertions(+), 14 deletions(-) rename docker/indra/build.go => cmd/docker/release/main.go (100%) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 3e9a76d1..8a0d95fb 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -1,4 +1,4 @@ -# This workflow will build a golang project +# This workflow will release a golang project # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go name: Go @@ -22,7 +22,7 @@ jobs: go-version: 1.19 - name: Build - run: go build -v ./... + run: go release -v ./... - name: Test run: go test -v ./... diff --git a/cmd/buidl/main.go b/cmd/buidl/main.go index 73e4ce71..0a47a418 100644 --- a/cmd/buidl/main.go +++ b/cmd/buidl/main.go @@ -133,7 +133,7 @@ var ( ParentGitCommit = "%s" // BuildTime stores the time when the current binary was built. BuildTime = "%s" - // SemVer lists the (latest) git tag on the build. + // SemVer lists the (latest) git tag on the release. SemVer = "%s" // PathBase is the path base returned from runtime caller. PathBase = "%s" diff --git a/cmd/bumper/main.go b/cmd/bumper/main.go index df518c4c..0589397c 100644 --- a/cmd/bumper/main.go +++ b/cmd/bumper/main.go @@ -1,7 +1,7 @@ // Package main is a tool for creating version information to be placed at the // repository root of a project. // -// It provides basic build information, references the parent Git commit hash, +// It provides basic release information, references the parent Git commit hash, // automatically increments the minor version, tags the commit with the version // so that it is easy for importing projects to use a Semantic Versioning // version code instead of depending on automatic generated codes from Go's @@ -194,7 +194,7 @@ var ( ParentGitCommit = "%s" // BuildTime stores the time when the current binary was built. BuildTime = "%s" - // SemVer lists the (latest) git tag on the build. + // SemVer lists the (latest) git tag on the release. SemVer = "%s" // PathBase is the path base returned from runtime caller. PathBase = "%s" diff --git a/docker/indra/build.go b/cmd/docker/release/main.go similarity index 100% rename from docker/indra/build.go rename to cmd/docker/release/main.go diff --git a/docker/indra/Dockerfile b/docker/indra/Dockerfile index caa7da52..d18d390c 100644 --- a/docker/indra/Dockerfile +++ b/docker/indra/Dockerfile @@ -17,7 +17,7 @@ RUN addgroup ${GROUP} --gid ${GID} \ "${USER}" \ && mkdir -pv /var/indra/.indra && chown -R indra:indra /var/indra -# Source/Target build defaults +# Source/Target release defaults ARG ARCH=amd64 ARG GOARCH=amd64 @@ -31,8 +31,8 @@ RUN set -ex \ # && if [ "${ARCH}" = "arm32v7" ]; then export GOARCH=arm; fi \ # && if [ "${ARCH}" = "arm64v8" ]; then export GOARCH=arm64; fi \ && go install -v ./cmd/indra/. \ - && mkdir -pv /build/bin \ - && CGO_ENABLED=0 go build --ldflags '-w -s' -o /build/bin/indra ./cmd/indra/. + && mkdir -pv /release/bin \ + && CGO_ENABLED=0 go release --ldflags '-w -s' -o /release/bin/indra ./cmd/indra/. # --- # Configure and Build the target container diff --git a/pkg/docker/builder.go b/pkg/docker/builder.go index 6f3a59cb..3ec34693 100644 --- a/pkg/docker/builder.go +++ b/pkg/docker/builder.go @@ -57,7 +57,7 @@ func (cli *Builder) Build() (err error) { buildOpts.Tags = append(buildOpts.Tags, buildRepositoryName + ":" + "stable") } - // Generate a tar file for docker's build context. It will contain the root of the repository's path. + // Generate a tar file for docker's release context. It will contain the root of the repository's path. // A tar file is passed in to the docker daemon. var tar io.ReadCloser @@ -68,9 +68,9 @@ func (cli *Builder) Build() (err error) { defer tar.Close() - // Submit a build to docker; with the context tar, and default options defined above. + // Submit a release to docker; with the context tar, and default options defined above. - log.I.Ln("submitting build to docker...") + log.I.Ln("submitting release to docker...") var response types.ImageBuildResponse @@ -90,14 +90,14 @@ func (cli *Builder) Build() (err error) { // Prune the intermediate golang:x.xx builder container - log.I.Ln("pruning build container(s)...") + log.I.Ln("pruning release container(s)...") if _, err = cli.ImagesPrune(cli.ctx, filters.NewArgs()); check(err) { return } log.I.Ln("pruning successful.") - log.I.Ln("build successful!") + log.I.Ln("release successful!") return } diff --git a/version.go b/version.go index f9792e4c..f5de0cfc 100644 --- a/version.go +++ b/version.go @@ -13,7 +13,7 @@ var ( ParentGitCommit = "2dc3027cf28b04b52b8bca3839a96267122f8b92" // BuildTime stores the time when the current binary was built. BuildTime = "2022-12-29T02:49:15Z" - // SemVer lists the (latest) git tag on the build. + // SemVer lists the (latest) git tag on the release. SemVer = "v0.0.255" // PathBase is the path base returned from runtime caller. PathBase = "/home/lyo/Seafile/Git/indra-labs/indra/"