Skip to content

Commit

Permalink
Merge branch 'release-4.19' into sync_ds--master
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikhil-Ladha authored Jan 29, 2025
2 parents a0ae1d9 + e04b504 commit 8248e5a
Show file tree
Hide file tree
Showing 48 changed files with 18,051 additions and 77 deletions.
1 change: 1 addition & 0 deletions .commitlintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"core",
"cosi",
"csi",
"csv",
"doc",
"docs",
"exporter",
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ jobs:

- name: build rook
run: |
# Install kubectl binary as required for generating csv
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/amd64/kubectl"
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
sudo chown root: /usr/local/bin/kubectl
GOPATH=$(go env GOPATH) make clean && make -j$nproc IMAGES='ceph' BUILD_CONTAINER_IMAGE=false build
- name: validate build
Expand Down Expand Up @@ -91,3 +97,9 @@ jobs:
- name: build.all rook with go ${{ matrix.go-version }}
run: |
tests/scripts/github-action-helper.sh build_rook_all
- name: run gen-csv
run: make csv-clean && GOPATH=$(go env GOPATH) make gen-csv

- name: validate gen-csv
run: tests/scripts/validate_modified_files.sh gen-csv
54 changes: 54 additions & 0 deletions .github/workflows/push-build-downstream.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Push Image Build Downstream
on:
push:
branches:
- master
- release-*

defaults:
run:
# reference: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#using-a-specific-shell
shell: bash --noprofile --norc -eo pipefail -x {0}

permissions:
contents: read

jobs:
push-image-to-container-registry:
runs-on: ubuntu-20.04
if: github.repository == 'red-hat-storage/rook'
steps:
- name: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-go@v5
with:
go-version: "1.21"

# docker/setup-qemu action installs QEMU static binaries, which are used to run builders for architectures other than the host.
- name: set up QEMU
uses: docker/setup-qemu-action@master
with:
platforms: all

- name: log in to container registry
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_OCS_DEV_ROBOT_USER }}
password: ${{ secrets.QUAY_OCS_DEV_ROBOT_PASSWORD }}

# creating custom env var
- name: set env
run: |
echo "BRANCH_NAME=${GITHUB_REF##*/}" >> $GITHUB_ENV
echo "GITHUB_SHA=${GITHUB_SHA}" >> $GITHUB_ENV
- name: build and release
env:
BRANCH_NAME: ${{ env.BRANCH_NAME }}
GITHUB_SHA: $ {{ env.GITHUB_SHA }}
run: |
tests/scripts/build-release-downstream.sh
13 changes: 13 additions & 0 deletions Dockerfile.bundle
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM scratch

# Core bundle labels.
LABEL operators.operatorframework.io.bundle.mediatype.v1=registry+v1
LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/
LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
LABEL operators.operatorframework.io.bundle.package.v1=rook-ceph-operator
LABEL operators.operatorframework.io.bundle.channels.v1=alpha
LABEL operators.operatorframework.io.bundle.channel.default.v1=alpha

# Copy files to locations specified by labels.
COPY build/csv/ceph /manifests/
COPY build/bundle/annotations.yaml /metadata/
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,25 @@ distclean: clean ## Remove all files that are created by building or configuring
prune: ## Prune cached artifacts.
@$(MAKE) -C images prune

# Change how CRDs are generated for CSVs
gen-csv: export MAX_DESC_LEN=0 # sets the description length to 0 since CSV cannot be bigger than 1MB
gen-csv: export NO_OB_OBC_VOL_GEN=true
gen-csv: csv-clean crds ## Generate a CSV file for OLM.
$(MAKE) -C images/ceph csv

bundle:
@echo generate rook bundle
@build/bundle/gen-bundle.sh

csv-clean: ## Remove existing OLM files.
@$(MAKE) -C images/ceph csv-clean

gen.crds: crds
crds: $(CONTROLLER_GEN) $(YQ)
@echo Updating CRD manifests
@build/crds/build-crds.sh $(CONTROLLER_GEN) $(YQ)
@GOBIN=$(GOBIN) build/crds/generate-crd-docs.sh
@build/crds/validate-csv-crd-list.sh

gen.rbac: gen-rbac
gen-rbac: $(HELM) $(YQ) ## Generate RBAC from Helm charts
Expand Down
6 changes: 6 additions & 0 deletions build/bundle/annotations.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
annotations:
operators.operatorframework.io.bundle.mediatype.v1: registry+v1
operators.operatorframework.io.bundle.manifests.v1: manifests/
operators.operatorframework.io.bundle.metadata.v1: metadata/
operators.operatorframework.io.bundle.package.v1: rook-ceph-operator
operators.operatorframework.io.bundle.channels.v1: alpha
21 changes: 21 additions & 0 deletions build/bundle/gen-bundle.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash
set -e

source "build/common.sh"

# Use the available container management tool
if [ -z "$DOCKERCMD" ]; then
DOCKERCMD=$(command -v docker || echo "")
fi
if [ -z "$DOCKERCMD" ]; then
DOCKERCMD=$(command -v podman || echo "")
fi

if [ -z "$DOCKERCMD" ]; then
echo -e '\033[1;31m' "podman or docker not found on system" '\033[0m'
exit 1
fi

${DOCKERCMD} build --platform="${GOOS}"/"${GOARCH}" --no-cache -t "$BUNDLE_IMAGE" -f Dockerfile.bundle .
echo
echo "Run '${DOCKERCMD} push ${BUNDLE_IMAGE}' to push operator bundle to image registry."
22 changes: 17 additions & 5 deletions build/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,37 @@ set -u
# See the License for the specific language governing permissions and
# limitations under the License.

BUILD_ROOT=$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd -P)
BUILD_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)
SHA256CMD=${SHA256CMD:-shasum -a 256}

DOCKERCMD=${DOCKERCMD:-docker}

export scriptdir
scriptdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
scriptdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
export OUTPUT_DIR=${BUILD_ROOT}/_output
export WORK_DIR=${BUILD_ROOT}/.work
export CACHE_DIR=${BUILD_ROOT}/.cache
export GOOS
GOOS=$(go env GOOS)
export GOARCH
GOARCH=$(go env GOARCH)
DEFAULT_CSV_VERSION="4.18.0"
CSV_VERSION="${CSV_VERSION:-${DEFAULT_CSV_VERSION}}"
SKIP_RANGE="${SKIP_RANGE:-""}"
REPLACES_CSV_VERSION="${REPLACES_CSV_VERSION:-""}"
LATEST_ROOK_IMAGE="docker.io/rook/ceph:v1.15.0.369.g7822e6b19"
ROOK_IMAGE=${ROOK_IMAGE:-${LATEST_ROOK_IMAGE}}
DEFAULT_BUNDLE_IMAGE=quay.io/ocs-dev/rook-ceph-operator-bundle:"${VERSION}"
BUNDLE_IMAGE="${BUNDLE_IMAGE:-${DEFAULT_BUNDLE_IMAGE}}"

function ver() {
local full_ver maj min bug build
full_ver="$1" # functions should name input params for easier understanding
full_ver="$1" # functions should name input params for easier understanding
maj="$(echo "${full_ver}" | cut -f1 -d'.')" # when splitting a param, name the components for easier understanding
min="$(echo "${full_ver}" | cut -f2 -d'.')"
bug="$(echo "${full_ver}" | cut -f3 -d'.')"
build="$(echo "${full_ver}" | cut -f4 -d'.')"
printf "%d%03d%03d%03d" "${maj}" "${min}" "${bug}" "${build}"
printf "%d%03d%03d%03d" "${maj}" "${min}" "${bug}" "${build}"
}

function check_git() {
Expand All @@ -42,7 +54,7 @@ function check_git() {
local gitversion
gitversion=$(git --version | cut -d" " -f3)

if (( $(ver "${gitversion}") > $(ver 2.6.6) && $(ver "${gitversion}") < $(ver 2.8.3) )); then
if (($(ver "${gitversion}") > $(ver 2.6.6) && $(ver "${gitversion}") < $(ver 2.8.3))); then
echo WARN: you are running git version "${gitversion}" which has a bug related to relative
echo WARN: submodule paths. Please consider upgrading to 2.8.3 or later
fi
Expand Down
12 changes: 12 additions & 0 deletions build/crds/validate-csv-crd-list.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

script_root=$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd -P)

list_of_crd_in_crd_yaml=$(grep -oE '[^ ]*\.ceph\.rook\.io' "${script_root}/deploy/examples/crds.yaml" | sort)
list_of_csv_in_csv_yaml=$(grep -oE '[^ ]*\.ceph\.rook\.io' "${script_root}/deploy/olm/assemble/metadata-common.yaml" | sort)

if [ "$list_of_crd_in_crd_yaml" != "$list_of_csv_in_csv_yaml" ]; then
echo "CRD list in crds.yaml file and metadata-common.yaml is different. Make sure to add crd in metadata-common.yaml."
echo -e "crd file list in crd.yaml:\n$list_of_crd_in_crd_yaml"
echo -e "crd file list in csv.yaml:\n$list_of_csv_in_csv_yaml"
fi
Loading

0 comments on commit 8248e5a

Please sign in to comment.