Skip to content

Commit

Permalink
bug-fix: add another tag for containers when pushing to quay with the…
Browse files Browse the repository at this point in the history
… latest commit sha

Signed-off-by: Aviel Segev <[email protected]>
  • Loading branch information
AvielSegev authored and machacekondra committed Jan 3, 2025
1 parent 3de786c commit 3663b73
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-push-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ jobs:
runs-on: ubuntu-latest
env:
REGISTRY: quay.io
# Set tag 'latest' on main branch
REGISTRY_TAG: ${{ (github.head_ref||github.ref_name)=='main' && 'latest' || (github.head_ref||github.ref_name) }}
# Set tag to the last commit sha on main branch, otherwise tag will be the branch name
REGISTRY_TAG: ${{ (github.head_ref||github.ref_name)=='main' && github.sha || (github.head_ref||github.ref_name) }}
REGISTRY_ORG: kubev2v
steps:
- name: Checkout forklift
Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ MIGRATION_PLANNER_API_IMAGE_PULL_POLICY ?= Always
MIGRATION_PLANNER_UI_IMAGE ?= quay.io/kubev2v/migration-planner-ui
MIGRATION_PLANNER_NAMESPACE ?= assisted-migration
INSECURE_REGISTRY ?= true
REGISTRY_TAG ?= latest
DOWNLOAD_RHCOS ?= true
KUBECTL ?= kubectl
IFACE ?= eth0
Expand Down Expand Up @@ -91,13 +92,14 @@ build-api: bin
build-agent: bin
go build -buildvcs=false $(GO_BUILD_FLAGS) -o $(GOBIN) ./cmd/planner-agent ...


# rebuild container only on source changes
bin/.migration-planner-agent-container: bin Containerfile.agent go.mod go.sum $(GO_FILES)
$(PODMAN) build . --build-arg VERSION=$(SOURCE_GIT_TAG) -f Containerfile.agent -t $(MIGRATION_PLANNER_AGENT_IMAGE):latest
$(PODMAN) image tag $(MIGRATION_PLANNER_AGENT_IMAGE):latest $(MIGRATION_PLANNER_AGENT_IMAGE):$(REGISTRY_TAG)

bin/.migration-planner-api-container: bin Containerfile.api go.mod go.sum $(GO_FILES)
$(PODMAN) build . -f Containerfile.api -t $(MIGRATION_PLANNER_API_IMAGE):latest
$(PODMAN) image tag $(MIGRATION_PLANNER_API_IMAGE):latest $(MIGRATION_PLANNER_API_IMAGE):$(REGISTRY_TAG)

migration-planner-api-container: bin/.migration-planner-api-container
migration-planner-agent-container: bin/.migration-planner-agent-container
Expand All @@ -108,7 +110,9 @@ build-containers: migration-planner-api-container migration-planner-agent-contai

push-containers: build-containers
$(PODMAN) push $(MIGRATION_PLANNER_API_IMAGE):latest
$(PODMAN) push $(MIGRATION_PLANNER_API_IMAGE):$(REGISTRY_TAG)
$(PODMAN) push $(MIGRATION_PLANNER_AGENT_IMAGE):latest
$(PODMAN) push $(MIGRATION_PLANNER_AGENT_IMAGE):$(REGISTRY_TAG)

deploy-on-kind:
sed "s|@MIGRATION_PLANNER_AGENT_IMAGE@|$(MIGRATION_PLANNER_AGENT_IMAGE)|g; \
Expand Down

0 comments on commit 3663b73

Please sign in to comment.