Skip to content

Commit 8248e5a

Browse files
authored
Merge branch 'release-4.19' into sync_ds--master
2 parents a0ae1d9 + e04b504 commit 8248e5a

File tree

48 files changed

+18051
-77
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+18051
-77
lines changed

.commitlintrc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"core",
1616
"cosi",
1717
"csi",
18+
"csv",
1819
"doc",
1920
"docs",
2021
"exporter",

.github/workflows/build.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ jobs:
3636

3737
- name: build rook
3838
run: |
39+
# Install kubectl binary as required for generating csv
40+
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/amd64/kubectl"
41+
chmod +x ./kubectl
42+
sudo mv ./kubectl /usr/local/bin/kubectl
43+
sudo chown root: /usr/local/bin/kubectl
44+
3945
GOPATH=$(go env GOPATH) make clean && make -j$nproc IMAGES='ceph' BUILD_CONTAINER_IMAGE=false build
4046
4147
- name: validate build
@@ -91,3 +97,9 @@ jobs:
9197
- name: build.all rook with go ${{ matrix.go-version }}
9298
run: |
9399
tests/scripts/github-action-helper.sh build_rook_all
100+
101+
- name: run gen-csv
102+
run: make csv-clean && GOPATH=$(go env GOPATH) make gen-csv
103+
104+
- name: validate gen-csv
105+
run: tests/scripts/validate_modified_files.sh gen-csv
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Push Image Build Downstream
2+
on:
3+
push:
4+
branches:
5+
- master
6+
- release-*
7+
8+
defaults:
9+
run:
10+
# reference: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#using-a-specific-shell
11+
shell: bash --noprofile --norc -eo pipefail -x {0}
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
push-image-to-container-registry:
18+
runs-on: ubuntu-20.04
19+
if: github.repository == 'red-hat-storage/rook'
20+
steps:
21+
- name: checkout
22+
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
26+
- uses: actions/setup-go@v5
27+
with:
28+
go-version: "1.21"
29+
30+
# docker/setup-qemu action installs QEMU static binaries, which are used to run builders for architectures other than the host.
31+
- name: set up QEMU
32+
uses: docker/setup-qemu-action@master
33+
with:
34+
platforms: all
35+
36+
- name: log in to container registry
37+
uses: docker/login-action@v3
38+
with:
39+
registry: quay.io
40+
username: ${{ secrets.QUAY_OCS_DEV_ROBOT_USER }}
41+
password: ${{ secrets.QUAY_OCS_DEV_ROBOT_PASSWORD }}
42+
43+
# creating custom env var
44+
- name: set env
45+
run: |
46+
echo "BRANCH_NAME=${GITHUB_REF##*/}" >> $GITHUB_ENV
47+
echo "GITHUB_SHA=${GITHUB_SHA}" >> $GITHUB_ENV
48+
49+
- name: build and release
50+
env:
51+
BRANCH_NAME: ${{ env.BRANCH_NAME }}
52+
GITHUB_SHA: $ {{ env.GITHUB_SHA }}
53+
run: |
54+
tests/scripts/build-release-downstream.sh

Dockerfile.bundle

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM scratch
2+
3+
# Core bundle labels.
4+
LABEL operators.operatorframework.io.bundle.mediatype.v1=registry+v1
5+
LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/
6+
LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
7+
LABEL operators.operatorframework.io.bundle.package.v1=rook-ceph-operator
8+
LABEL operators.operatorframework.io.bundle.channels.v1=alpha
9+
LABEL operators.operatorframework.io.bundle.channel.default.v1=alpha
10+
11+
# Copy files to locations specified by labels.
12+
COPY build/csv/ceph /manifests/
13+
COPY build/bundle/annotations.yaml /metadata/

Makefile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,11 +187,25 @@ distclean: clean ## Remove all files that are created by building or configuring
187187
prune: ## Prune cached artifacts.
188188
@$(MAKE) -C images prune
189189

190+
# Change how CRDs are generated for CSVs
191+
gen-csv: export MAX_DESC_LEN=0 # sets the description length to 0 since CSV cannot be bigger than 1MB
192+
gen-csv: export NO_OB_OBC_VOL_GEN=true
193+
gen-csv: csv-clean crds ## Generate a CSV file for OLM.
194+
$(MAKE) -C images/ceph csv
195+
196+
bundle:
197+
@echo generate rook bundle
198+
@build/bundle/gen-bundle.sh
199+
200+
csv-clean: ## Remove existing OLM files.
201+
@$(MAKE) -C images/ceph csv-clean
202+
190203
gen.crds: crds
191204
crds: $(CONTROLLER_GEN) $(YQ)
192205
@echo Updating CRD manifests
193206
@build/crds/build-crds.sh $(CONTROLLER_GEN) $(YQ)
194207
@GOBIN=$(GOBIN) build/crds/generate-crd-docs.sh
208+
@build/crds/validate-csv-crd-list.sh
195209

196210
gen.rbac: gen-rbac
197211
gen-rbac: $(HELM) $(YQ) ## Generate RBAC from Helm charts

build/bundle/annotations.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
annotations:
2+
operators.operatorframework.io.bundle.mediatype.v1: registry+v1
3+
operators.operatorframework.io.bundle.manifests.v1: manifests/
4+
operators.operatorframework.io.bundle.metadata.v1: metadata/
5+
operators.operatorframework.io.bundle.package.v1: rook-ceph-operator
6+
operators.operatorframework.io.bundle.channels.v1: alpha

build/bundle/gen-bundle.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
source "build/common.sh"
5+
6+
# Use the available container management tool
7+
if [ -z "$DOCKERCMD" ]; then
8+
DOCKERCMD=$(command -v docker || echo "")
9+
fi
10+
if [ -z "$DOCKERCMD" ]; then
11+
DOCKERCMD=$(command -v podman || echo "")
12+
fi
13+
14+
if [ -z "$DOCKERCMD" ]; then
15+
echo -e '\033[1;31m' "podman or docker not found on system" '\033[0m'
16+
exit 1
17+
fi
18+
19+
${DOCKERCMD} build --platform="${GOOS}"/"${GOARCH}" --no-cache -t "$BUNDLE_IMAGE" -f Dockerfile.bundle .
20+
echo
21+
echo "Run '${DOCKERCMD} push ${BUNDLE_IMAGE}' to push operator bundle to image registry."

build/common.sh

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,37 @@ set -u
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

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

2020
DOCKERCMD=${DOCKERCMD:-docker}
2121

2222
export scriptdir
23-
scriptdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
23+
scriptdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
2424
export OUTPUT_DIR=${BUILD_ROOT}/_output
2525
export WORK_DIR=${BUILD_ROOT}/.work
2626
export CACHE_DIR=${BUILD_ROOT}/.cache
27+
export GOOS
28+
GOOS=$(go env GOOS)
29+
export GOARCH
30+
GOARCH=$(go env GOARCH)
31+
DEFAULT_CSV_VERSION="4.18.0"
32+
CSV_VERSION="${CSV_VERSION:-${DEFAULT_CSV_VERSION}}"
33+
SKIP_RANGE="${SKIP_RANGE:-""}"
34+
REPLACES_CSV_VERSION="${REPLACES_CSV_VERSION:-""}"
35+
LATEST_ROOK_IMAGE="docker.io/rook/ceph:v1.15.0.369.g7822e6b19"
36+
ROOK_IMAGE=${ROOK_IMAGE:-${LATEST_ROOK_IMAGE}}
37+
DEFAULT_BUNDLE_IMAGE=quay.io/ocs-dev/rook-ceph-operator-bundle:"${VERSION}"
38+
BUNDLE_IMAGE="${BUNDLE_IMAGE:-${DEFAULT_BUNDLE_IMAGE}}"
2739

2840
function ver() {
2941
local full_ver maj min bug build
30-
full_ver="$1" # functions should name input params for easier understanding
42+
full_ver="$1" # functions should name input params for easier understanding
3143
maj="$(echo "${full_ver}" | cut -f1 -d'.')" # when splitting a param, name the components for easier understanding
3244
min="$(echo "${full_ver}" | cut -f2 -d'.')"
3345
bug="$(echo "${full_ver}" | cut -f3 -d'.')"
3446
build="$(echo "${full_ver}" | cut -f4 -d'.')"
35-
printf "%d%03d%03d%03d" "${maj}" "${min}" "${bug}" "${build}"
47+
printf "%d%03d%03d%03d" "${maj}" "${min}" "${bug}" "${build}"
3648
}
3749

3850
function check_git() {
@@ -42,7 +54,7 @@ function check_git() {
4254
local gitversion
4355
gitversion=$(git --version | cut -d" " -f3)
4456

45-
if (( $(ver "${gitversion}") > $(ver 2.6.6) && $(ver "${gitversion}") < $(ver 2.8.3) )); then
57+
if (($(ver "${gitversion}") > $(ver 2.6.6) && $(ver "${gitversion}") < $(ver 2.8.3))); then
4658
echo WARN: you are running git version "${gitversion}" which has a bug related to relative
4759
echo WARN: submodule paths. Please consider upgrading to 2.8.3 or later
4860
fi

build/crds/validate-csv-crd-list.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
3+
script_root=$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd -P)
4+
5+
list_of_crd_in_crd_yaml=$(grep -oE '[^ ]*\.ceph\.rook\.io' "${script_root}/deploy/examples/crds.yaml" | sort)
6+
list_of_csv_in_csv_yaml=$(grep -oE '[^ ]*\.ceph\.rook\.io' "${script_root}/deploy/olm/assemble/metadata-common.yaml" | sort)
7+
8+
if [ "$list_of_crd_in_crd_yaml" != "$list_of_csv_in_csv_yaml" ]; then
9+
echo "CRD list in crds.yaml file and metadata-common.yaml is different. Make sure to add crd in metadata-common.yaml."
10+
echo -e "crd file list in crd.yaml:\n$list_of_crd_in_crd_yaml"
11+
echo -e "crd file list in csv.yaml:\n$list_of_csv_in_csv_yaml"
12+
fi

0 commit comments

Comments
 (0)