Skip to content

Commit 1d9bc5b

Browse files
Merge pull request #2736 from Nordix/lentzi90/release-artifacts
🌱 Add release manifests
2 parents 6bb2025 + db52201 commit 1d9bc5b

File tree

5 files changed

+31
-8
lines changed

5 files changed

+31
-8
lines changed

.github/workflows/e2e-fixture-test.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ jobs:
2929
3030
- name: Build BMO e2e Docker Image
3131
env:
32-
IMG: quay.io/metal3-io/baremetal-operator:e2e
32+
IMG: quay.io/metal3-io/baremetal-operator
33+
IMG_TAG: e2e
3334
run: make docker
3435

3536
- name: Set Up Environment and Run BMO e2e Tests

.github/workflows/release.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ jobs:
108108
go-version: ${{ env.go_version }}
109109
- name: generate release artifacts
110110
run: |
111-
make release-notes
111+
make release
112112
env:
113113
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
114114
- name: get release notes
@@ -119,6 +119,7 @@ jobs:
119119
uses: softprops/action-gh-release@6cbd405e2c4e67a21c47fa9e383d020e4e28b836 # v2.3.3
120120
with:
121121
draft: true
122+
files: out/*
122123
body_path: ${{ env.RELEASE_TAG }}.md
123124
tag_name: ${{ env.RELEASE_TAG }}
124125
build_bmo:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ build/_test
55
_artifacts
66
artifacts*.tar.gz
77
test/e2e/images
8+
out
89

910
# Created by https://www.gitignore.io/api/go
1011
### Go ###

Makefile

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,10 @@ help: ## Display this help
8787
@echo " DEBUG -- debug flag, if any ($(DEBUG))"
8888

8989
# Image URL to use all building/pushing image targets
90+
REGISTRY ?= quay.io/metal3-io
9091
IMG_NAME ?= baremetal-operator
9192
IMG_TAG ?= latest
92-
IMG ?= $(IMG_NAME):$(IMG_TAG)
93+
IMG ?= $(REGISTRY)/$(IMG_NAME)
9394

9495
## --------------------------------------
9596
## Test Targets
@@ -225,10 +226,15 @@ manifests-generate: $(CONTROLLER_GEN)
225226
manifests-kustomize: $(KUSTOMIZE)
226227
$< build config/default > config/render/capm3.yaml
227228

229+
.PHONY: set-manifest-pull-policy
230+
set-manifest-pull-policy:
231+
$(info Updating kustomize pull policy file for manager resource)
232+
sed -i'' -e 's@imagePullPolicy: .*@imagePullPolicy: '"$(PULL_POLICY)"'@' ./config/base/manager.yaml
233+
228234
.PHONY: set-manifest-image-bmo
229235
set-manifest-image-bmo: $(KUSTOMIZE) manifests
230236
$(info Updating container image for BMO to use ${MANIFEST_IMG}:${MANIFEST_TAG})
231-
cd config/base && $(abspath $(KUSTOMIZE)) edit set image quay.io/metal3-io/baremetal-operator=${MANIFEST_IMG}:${MANIFEST_TAG}
237+
sed -i'' -e 's@image: .*@image: \"'"${MANIFEST_IMG}:$(MANIFEST_TAG)"'\"@' ./config/base/manager.yaml
232238

233239
.PHONY: set-manifest-image-ironic
234240
set-manifest-image-ironic: $(KUSTOMIZE) manifests
@@ -261,21 +267,21 @@ generate: $(CONTROLLER_GEN) ## Generate code
261267

262268
.PHONY: docker
263269
docker: generate manifests ## Build the docker image
264-
docker build . -t ${IMG} \
270+
docker build . -t ${IMG}:${IMG_TAG} \
265271
--build-arg http_proxy=$(http_proxy) \
266272
--build-arg https_proxy=$(https_proxy)
267273

268274
.PHONY: docker-debug
269275
docker-debug: generate manifests ## Build the docker image with debug info
270-
docker build . -t ${IMG} \
276+
docker build . -t ${IMG}:${IMG_TAG} \
271277
--build-arg http_proxy=$(http_proxy) \
272278
--build-arg https_proxy=$(https_proxy) \
273279
--build-arg LDFLAGS="-extldflags=-static"
274280

275281
# Push the docker image
276282
.PHONY: docker-push
277283
docker-push:
278-
docker push ${IMG}
284+
docker push ${IMG}:${IMG_TAG}
279285

280286
## --------------------------------------
281287
## CI Targets
@@ -367,6 +373,20 @@ $(RELEASE_NOTES_DIR):
367373
release-notes: $(RELEASE_NOTES_DIR) $(RELEASE_NOTES)
368374
cd hack/tools && $(GO) run release/notes.go --releaseTag=$(RELEASE_TAG) > $(realpath $(RELEASE_NOTES_DIR))/$(RELEASE_TAG).md
369375

376+
.PHONY: release-manifests
377+
release-manifests: $(KUSTOMIZE) $(RELEASE_DIR) ## Builds the manifests to publish with a release
378+
$(KUSTOMIZE) build config > $(RELEASE_DIR)/baremetal-operator.yaml
379+
380+
.PHONY: release
381+
release:
382+
@if [ -z "${RELEASE_TAG}" ]; then echo "RELEASE_TAG is not set"; exit 1; fi
383+
@if ! [ -z "$$(git status --porcelain)" ]; then echo "You have uncommitted changes"; exit 1; fi
384+
git checkout "${RELEASE_TAG}"
385+
MANIFEST_IMG=$(IMG) MANIFEST_TAG=$(RELEASE_TAG) $(MAKE) set-manifest-image-bmo
386+
PULL_POLICY=IfNotPresent $(MAKE) set-manifest-pull-policy
387+
$(MAKE) release-manifests
388+
$(MAKE) release-notes
389+
370390
go-version: ## Print the go version we use to compile our binaries and images
371391
@echo $(GO_VERSION)
372392

hack/ci-e2e.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ sudo apt-get update
5757
sudo apt-get install -y libvirt-dev pkg-config
5858

5959
# Build the container image with e2e tag (used in tests)
60-
IMG=quay.io/metal3-io/baremetal-operator:e2e make docker
60+
IMG=quay.io/metal3-io/baremetal-operator IMG_TAG=e2e make docker
6161

6262
if ! sudo virsh net-list --all | grep baremetal-e2e; then
6363
virsh -c qemu:///system net-define "${REPO_ROOT}/hack/e2e/net.xml"

0 commit comments

Comments
 (0)