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

Ensure image version consistency #261

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 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
13 changes: 4 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2021-2024 Dell Inc., or its subsidiaries. All Rights Reserved.
# Copyright (c) 2021-2025 Dell Inc., or its subsidiaries. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -13,12 +13,6 @@
# limitations under the License.
# Includes the following generated file to get semantic version information

MAJOR=1
MINOR=12
PATCH=0
VERSION?="v$(MAJOR).$(MINOR).$(PATCH)"
REGISTRY?="${REGISTRY_HOST}:${REGISTRY_PORT}/podmon"

all: clean podman push

unit-test:
Expand All @@ -32,10 +26,11 @@ build:

podman: download-csm-common
$(eval include csm-common.mk)
podman build --pull --no-cache -t "$(REGISTRY):$(VERSION)" --build-arg GOIMAGE=$(DEFAULT_GOIMAGE) --build-arg BASEIMAGE=$(CSM_BASEIMAGE) -f ./Dockerfile --label commit=$(shell git log --max-count 1 --format="%H") .
go run core/semver/semver.go -f mk >semver.mk
make -f docker.mk podman DEFAULT_GOIMAGE=$(DEFAULT_GOIMAGE) CSM_BASEIMAGE=$(CSM_BASEIMAGE)

push:
podman push "$(REGISTRY):$(VERSION)"
make -f docker.mk push

download-csm-common:
curl -O -L https://raw.githubusercontent.com/dell/csm/main/config/csm-common.mk
Expand Down
1 change: 1 addition & 0 deletions core/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
core_generated.go
34 changes: 34 additions & 0 deletions core/core.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Copyright © 2021 - 2025 Dell Inc. or its subsidiaries. All Rights Reserved.
riya-kaushal7997 marked this conversation as resolved.
Show resolved Hide resolved
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

//go:generate go run semver/semver.go -f semver.tpl -o core_generated.go

package core

import "time"

var (
// SemVer is the semantic version.
SemVer = "unknown"

// CommitSha7 is the short version of the commit hash from which
// this program was built.
CommitSha7 string

// CommitSha32 is the long version of the commit hash from which
// this program was built.
CommitSha32 string

// CommitTime is the commit timestamp of the commit from which
// this program was built.
CommitTime time.Time
)
11 changes: 11 additions & 0 deletions core/semver.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package core

import "time"

func init() {
SemVer = "{{.SemVer}}"
CommitSha7 = "{{.Sha7}}"
CommitSha32 = "{{.Sha32}}"
CommitTime = time.Unix({{.Epoch}}, 0)
}

Loading