Skip to content

Commit

Permalink
Updating ubi micro dependencies (#594)
Browse files Browse the repository at this point in the history
* Updating ubi micro dependencies
  • Loading branch information
rodrigobassil authored Jun 11, 2024
1 parent 35b9b82 commit da4a222
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 12 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,17 @@ jobs:
- name: Checkout the code
uses: actions/checkout@v4
- name: Build Docker Images
run: DEFAULT_IMG=csm-operator:latest make -o gen-semver docker-build
run: |
chmod +x ./scripts/build-ubi-micro.sh
make build-base-image
make -o gen-semver
podman build -t docker.io/csm-operator -f ./Dockerfile --build-arg GOIMAGE=golang:latest --build-arg BASEIMAGE="localhost/csm-operator-ubimicro"
podman save docker.io/library/csm-operator -o /tmp/csm-operator.tar
docker load -i /tmp/csm-operator.tar
- name: Scan controller Image
uses: Azure/container-scan@v0
env:
DOCKLE_HOST: "unix:///var/run/docker.sock"
with:
image-name: csm-operator:latest
image-name: csm-operator
severity-threshold: HIGH
24 changes: 14 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,11 @@ build: gen-semver fmt vet ## Build manager binary.
run: generate gen-semver fmt vet static-manifests ## Run a controller from your host.
go run ./main.go

podman-build: gen-semver download-csm-common ## Build podman image with the manager.
$(eval include csm-common.mk)
podman build . -t ${DEFAULT_IMG} --build-arg BASEIMAGE=$(DEFAULT_BASEIMAGE) --build-arg GOIMAGE=$(DEFAULT_GOIMAGE)
podman-build: gen-semver build-base-image ## Build podman image with the manager.
podman build . -t ${DEFAULT_IMG} --build-arg BASEIMAGE=$(BASEIMAGE) --build-arg GOIMAGE=$(DEFAULT_GOIMAGE)

docker-build: gen-semver download-csm-common ## Build docker image with the manager.
$(eval include csm-common.mk)
docker build . -t ${DEFAULT_IMG} --build-arg BASEIMAGE=$(DEFAULT_BASEIMAGE) --build-arg GOIMAGE=$(DEFAULT_GOIMAGE)
docker-build: gen-semver build-base-image ## Build docker image with the manager.
docker build . -t ${DEFAULT_IMG} --build-arg BASEIMAGE=$(BASEIMAGE) --build-arg GOIMAGE=$(DEFAULT_GOIMAGE)

docker-push: docker-build ## Builds, tags and pushes docker image with the manager.
docker tag ${DEFAULT_IMG} ${IMG}
Expand Down Expand Up @@ -166,9 +164,9 @@ bundle: static-manifests gen-semver kustomize ## Generate bundle manifests and m
operator-sdk bundle validate ./bundle

.PHONY: bundle-build
bundle-build: gen-semver download-csm-common ## Build the bundle image.
$(eval include csm-common.mk)
docker build -f bundle.Dockerfile -t $(BUNDLE_IMG) --build-arg BASEIMAGE=$(DEFAULT_BASEIMAGE) .
bundle-build: gen-semver build-base-image ## Build the bundle image.
docker build -f bundle.Dockerfile -t $(BUNDLE_IMG) --build-arg BASEIMAGE=$(BASEIMAGE) .


.PHONY: bundle-push
bundle-push: gen-semver ## Push the bundle image.
Expand Down Expand Up @@ -217,7 +215,13 @@ catalog-push: gen-semver ## Push a catalog image.
lint: build
golangci-lint run --fix

.PHONY: build-base-image
build-base-image: download-csm-common
$(eval include csm-common.mk)
sh ./scripts/build-ubi-micro.sh $(DEFAULT_BASEIMAGE)
$(eval BASEIMAGE=csm-operator-ubimicro:latest)

# Download common CSM configuration file used for builds
.PHONY: download-csm-common
download-csm-common:
curl -O -L https://raw.githubusercontent.com/dell/csm/main/config/csm-common.mk
curl -O -L https://raw.githubusercontent.com/dell/csm/main/config/csm-common.mk
23 changes: 23 additions & 0 deletions scripts/build-ubi-micro.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/sh
# Copyright (c) 2024 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.
# 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.

#!/bin/bash

microcontainer=$(buildah from $1)
micromount=$(buildah mount $microcontainer)
dnf install --installroot $micromount --releasever=8 --nodocs --setopt install_weak_deps=false --setopt=reposdir=/etc/yum.repos.d/ rpm -y
dnf clean all --installroot $micromount
buildah umount $microcontainer
buildah commit $microcontainer csm-operator-ubimicro

0 comments on commit da4a222

Please sign in to comment.