Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 58 additions & 3 deletions scripts/generate_crds_manifests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,65 @@ crddir="${chartdir}/crds"
crdsrcdir="${tmpdir}/operators"

SED="sed"
if ! command -v ${SED} &> /dev/null; then
SED="sed"
if command -v gsed &> /dev/null; then
SED="gsed"
elif ! command -v "${SED}" &> /dev/null; then
echo "GNU sed is required for creating manifests, unable to proceed"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@grokspawn

The config does not solve the fact that the script looks for sed.
On Mac we have gsed ( with the config : https://operator-framework.github.io/operator-controller/contribute/developer/#special-setup-for-macos )

 $ make verify
Checking for unstaged root vendor changes
/Library/Developer/CommandLineTools/usr/bin/make verify-vendor
go mod tidy
go mod vendor
go mod verify
all modules verified
/Library/Developer/CommandLineTools/usr/bin/make diff
git diff --stat HEAD --ignore-submodules --exit-code
Checking whether the CVO manifests need to be generated
/Library/Developer/CommandLineTools/usr/bin/make verify-manifests
OLM_VERSION=0.0.1-snapshot ./scripts/generate_crds_manifests.sh
GNU sed is required for creating manifests, unable to proceed
make[1]: *** [manifests] Error 1
make: *** [verify] Error 2

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$ brew install bash gnu-tar gsed coreutils

Error: Another `brew update` process is already running.
Please wait for it to finish or terminate it to continue.
==> Downloading https://formulae.brew.sh/api/formula.jws.json
==> Downloading https://formulae.brew.sh/api/formula_tap_migrations.jws.json
==> Downloading https://formulae.brew.sh/api/cask.jws.json
bash 5.2.37 is already installed but outdated (so it will be upgraded).
Warning: gnu-tar 1.35 is already installed and up-to-date.
To reinstall 1.35, run:
  brew reinstall gnu-tar
Warning: gnu-sed 4.9 is already installed and up-to-date.
To reinstall 4.9, run:
  brew reinstall gnu-sed
coreutils 9.6 is already installed but outdated (so it will be upgraded).
==> Fetching downloads for: bash and coreutils
==> Downloading https://ghcr.io/v2/homebrew/core/bash/manifests/5.3.3-1
############################################################################################################# 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/coreutils/manifests/9.8-1
############################################################################################################# 100.0%
==> Fetching dependencies for bash: ncurses, readline and gettext
==> Downloading https://ghcr.io/v2/homebrew/core/ncurses/manifests/6.5
############################################################################################################# 100.0%
==> Fetching ncurses
==> Downloading https://ghcr.io/v2/homebrew/core/ncurses/blobs/sha256:ee5253473badfa0701deac8e9973a7358c761dd287f0d7
############################################################################################################# 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/readline/manifests/8.3.1
############################################################################################################# 100.0%
==> Fetching readline
==> Downloading https://ghcr.io/v2/homebrew/core/readline/blobs/sha256:51a9a7122a89fd2464fc631f8c31721afc700b3b220ed
############################################################################################################# 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/gettext/manifests/0.26
############################################################################################################# 100.0%
==> Fetching gettext
==> Downloading https://ghcr.io/v2/homebrew/core/gettext/blobs/sha256:1615e931a23c6875c9bcae0ffccf5a4a35f796fb90b719
############################################################################################################# 100.0%
==> Fetching bash
==> Downloading https://ghcr.io/v2/homebrew/core/bash/blobs/sha256:82f6c2822bd49dae8d15be45fc347ebc91100de1fdad421b1
############################################################################################################# 100.0%
==> Fetching coreutils
==> Downloading https://ghcr.io/v2/homebrew/core/coreutils/blobs/sha256:fce6e52bd1afd5e8e91446f0def571ff4339bac5d866
############################################################################################################# 100.0%
==> Upgrading bash
  5.2.37 -> 5.3.3 
==> Installing dependencies for bash: ncurses, readline and gettext
==> Installing bash dependency: ncurses
==> Downloading https://ghcr.io/v2/homebrew/core/ncurses/manifests/6.5
Already downloaded: /Users/camilam/Library/Caches/Homebrew/downloads/b2f8ce4e08b15832435170efd265346225ee388d5baab3d5c50e3a77c5673b5a--ncurses-6.5.bottle_manifest.json
==> Pouring ncurses--6.5.arm64_sonoma.bottle.tar.gz
🍺  /opt/homebrew/Cellar/ncurses/6.5: 4,052 files, 9.9MB
==> Installing bash dependency: readline
==> Downloading https://ghcr.io/v2/homebrew/core/readline/manifests/8.3.1
Already downloaded: /Users/camilam/Library/Caches/Homebrew/downloads/52cb2bb3f0d9e66789968b865501c41ed80dc303eb488939476b309f1d350dc5--readline-8.3.1.bottle_manifest.json
==> Pouring readline--8.3.1.arm64_sonoma.bottle.tar.gz
🍺  /opt/homebrew/Cellar/readline/8.3.1: 56 files, 2.6MB
==> Installing bash dependency: gettext
==> Downloading https://ghcr.io/v2/homebrew/core/gettext/manifests/0.26
Already downloaded: /Users/camilam/Library/Caches/Homebrew/downloads/d28158ffec04fae757cdbeb46750e8e2ed43b7b17ada49d72a5bda2cff4cd6ed--gettext-0.26.bottle_manifest.json
==> Pouring gettext--0.26.arm64_sonoma.bottle.tar.gz
🍺  /opt/homebrew/Cellar/gettext/0.26: 2,428 files, 28.3MB
==> Installing bash
==> Pouring bash--5.3.3.arm64_sonoma.bottle.1.tar.gz
==> Caveats
DEFAULT_LOADABLE_BUILTINS_PATH: /opt/homebrew/lib/bash:/usr/local/lib/bash:/usr/lib/bash:/opt/local/lib/bash:/usr/pkg/lib/bash:/opt/pkg/lib/bash:.
==> Summary
🍺  /opt/homebrew/Cellar/bash/5.3.3: 172 files, 13.1MB
==> Running `brew cleanup bash`...
Disable this behaviour by setting `HOMEBREW_NO_INSTALL_CLEANUP=1`.
Hide these hints with `HOMEBREW_NO_ENV_HINTS=1` (see `man brew`).
Removing: /opt/homebrew/Cellar/bash/5.2.37... (163 files, 12.4MB)
==> Upgrading coreutils
  9.6 -> 9.8 
==> Pouring coreutils--9.8.arm64_sonoma.bottle.1.tar.gz
==> Caveats
Commands also provided by macOS and the commands dir, dircolors, vdir have been installed with the prefix "g".
If you need to use these commands with their normal names, you can add a "gnubin" directory to your PATH with:
  PATH="/opt/homebrew/opt/coreutils/libexec/gnubin:$PATH"
==> Summary
🍺  /opt/homebrew/Cellar/coreutils/9.8: 477 files, 12.2MB
==> Running `brew cleanup coreutils`...
Removing: /opt/homebrew/Cellar/coreutils/9.6... (477 files, 11.7MB)
==> No outdated dependents to upgrade!
==> Caveats
==> bash
DEFAULT_LOADABLE_BUILTINS_PATH: /opt/homebrew/lib/bash:/usr/local/lib/bash:/usr/lib/bash:/opt/local/lib/bash:/usr/pkg/lib/bash:/opt/pkg/lib/bash:.
==> coreutils

I have all setup already.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you follow the "Configure your Shell" portion of the doc, then sed is gsed:

$ which sed
/opt/homebrew/opt/gsed/libexec/gnubin/sed
$ which gsed
/opt/homebrew/bin/gsed
$ ll /opt/homebrew/opt/gsed/libexec/gnubin/sed
lrwxr-xr-x 1 jordan 14 Nov  6  2022 /opt/homebrew/opt/gsed/libexec/gnubin/sed -> ../../bin/gsed

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You also need your path updated. Doing the brew install is not enough.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. I mised that. Done and worked. Created the sislink

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$ whence -a sed
/opt/homebrew/opt/gsed/libexec/gnubin/sed
/opt/homebrew/opt/gnu-sed/libexec/gnubin/sed
/usr/bin/sed

exit 1
fi

relpath() {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@grokspawn

The config either does not solve realpath --relative-to on mac

$ make verify
Checking for unstaged root vendor changes
/Library/Developer/CommandLineTools/usr/bin/make verify-vendor
go mod tidy
go mod vendor
go mod verify
all modules verified
/Library/Developer/CommandLineTools/usr/bin/make diff
git diff --stat HEAD --ignore-submodules --exit-code
Checking whether the CVO manifests need to be generated
/Library/Developer/CommandLineTools/usr/bin/make verify-manifests
OLM_VERSION=0.0.1-snapshot ./scripts/generate_crds_manifests.sh
./tmp.CG3tBj8ZFm/chart/crds/operators.coreos.com_catalogsources.yaml -> ./tmp.CG3tBj8ZFm/chart/crds/0000_50_olm_00-catalogsources.crd.yaml
./tmp.CG3tBj8ZFm/chart/crds/operators.coreos.com_clusterserviceversions.yaml -> ./tmp.CG3tBj8ZFm/chart/crds/0000_50_olm_00-clusterserviceversions.crd.yaml
./tmp.CG3tBj8ZFm/chart/crds/operators.coreos.com_installplans.yaml -> ./tmp.CG3tBj8ZFm/chart/crds/0000_50_olm_00-installplans.crd.yaml
./tmp.CG3tBj8ZFm/chart/crds/operators.coreos.com_olmconfigs.yaml -> ./tmp.CG3tBj8ZFm/chart/crds/0000_50_olm_00-olmconfigs.crd.yaml
./tmp.CG3tBj8ZFm/chart/crds/operators.coreos.com_operatorconditions.yaml -> ./tmp.CG3tBj8ZFm/chart/crds/0000_50_olm_00-operatorconditions.crd.yaml
./tmp.CG3tBj8ZFm/chart/crds/operators.coreos.com_operatorgroups.yaml -> ./tmp.CG3tBj8ZFm/chart/crds/0000_50_olm_00-operatorgroups.crd.yaml
./tmp.CG3tBj8ZFm/chart/crds/operators.coreos.com_operators.yaml -> ./tmp.CG3tBj8ZFm/chart/crds/0000_50_olm_00-operators.crd.yaml
./tmp.CG3tBj8ZFm/chart/crds/operators.coreos.com_subscriptions.yaml -> ./tmp.CG3tBj8ZFm/chart/crds/0000_50_olm_00-subscriptions.crd.yaml
wrote ./tmp.CG3tBj8ZFm/chart/olm/crds/0000_50_olm_00-catalogsources.crd.yaml
wrote ./tmp.CG3tBj8ZFm/chart/olm/crds/0000_50_olm_00-clusterserviceversions.crd.yaml
wrote ./tmp.CG3tBj8ZFm/chart/olm/crds/0000_50_olm_00-installplans.crd.yaml
wrote ./tmp.CG3tBj8ZFm/chart/olm/crds/0000_50_olm_00-olmconfigs.crd.yaml
wrote ./tmp.CG3tBj8ZFm/chart/olm/crds/0000_50_olm_00-operatorconditions.crd.yaml
wrote ./tmp.CG3tBj8ZFm/chart/olm/crds/0000_50_olm_00-operatorgroups.crd.yaml
wrote ./tmp.CG3tBj8ZFm/chart/olm/crds/0000_50_olm_00-operators.crd.yaml
wrote ./tmp.CG3tBj8ZFm/chart/olm/crds/0000_50_olm_00-subscriptions.crd.yaml
wrote ./tmp.CG3tBj8ZFm/chart/olm/templates/0000_50_olm_00-namespace.yaml
wrote ./tmp.CG3tBj8ZFm/chart/olm/templates/0000_50_olm_00-namespace.yaml
wrote ./tmp.CG3tBj8ZFm/chart/olm/templates/0000_50_olm_01-networkpolicies.yaml
wrote ./tmp.CG3tBj8ZFm/chart/olm/templates/0000_50_olm_01-networkpolicies.yaml
wrote ./tmp.CG3tBj8ZFm/chart/olm/templates/0000_50_olm_01-networkpolicies.yaml
wrote ./tmp.CG3tBj8ZFm/chart/olm/templates/0000_50_olm_01-networkpolicies.yaml
wrote ./tmp.CG3tBj8ZFm/chart/olm/templates/0000_50_olm_01-networkpolicies.yaml
wrote ./tmp.CG3tBj8ZFm/chart/olm/templates/0000_50_olm_02-olm-operator.serviceaccount.yaml
wrote ./tmp.CG3tBj8ZFm/chart/olm/templates/0000_50_olm_02-olm-operator.serviceaccount.yaml
wrote ./tmp.CG3tBj8ZFm/chart/olm/templates/0000_50_olm_09-aggregated.clusterrole.yaml
wrote ./tmp.CG3tBj8ZFm/chart/olm/templates/0000_50_olm_09-aggregated.clusterrole.yaml
wrote ./tmp.CG3tBj8ZFm/chart/olm/templates/0000_50_olm_02-olm-operator.serviceaccount.yaml
wrote ./tmp.CG3tBj8ZFm/chart/olm/templates/0000_90_olm_00-service-monitor.yaml
wrote ./tmp.CG3tBj8ZFm/chart/olm/templates/0000_90_olm_00-service-monitor.yaml
wrote ./tmp.CG3tBj8ZFm/chart/olm/templates/0000_50_olm_03-services.yaml
wrote ./tmp.CG3tBj8ZFm/chart/olm/templates/0000_50_olm_03-services.yaml
wrote ./tmp.CG3tBj8ZFm/chart/olm/templates/0000_50_olm_07-olm-operator.deployment.yaml
wrote ./tmp.CG3tBj8ZFm/chart/olm/templates/0000_50_olm_08-catalog-operator.deployment.yaml
wrote ./tmp.CG3tBj8ZFm/chart/olm/templates/0000_50_olm_99-operatorstatus.yaml
wrote ./tmp.CG3tBj8ZFm/chart/olm/templates/0000_50_olm_99-operatorstatus.yaml
wrote ./tmp.CG3tBj8ZFm/chart/olm/templates/0000_50_olm_99-operatorstatus.yaml
wrote ./tmp.CG3tBj8ZFm/chart/olm/templates/0000_50_olm_15-packageserver.clusterserviceversion.yaml
wrote ./tmp.CG3tBj8ZFm/chart/olm/templates/0000_50_olm_03-olmconfig.yaml
wrote ./tmp.CG3tBj8ZFm/chart/olm/templates/0000_50_olm_13-operatorgroup-default.yaml
wrote ./tmp.CG3tBj8ZFm/chart/olm/templates/0000_50_olm_13-operatorgroup-default.yaml
wrote ./tmp.CG3tBj8ZFm/chart/olm/templates/0000_90_olm_01-prometheus-rule.yaml
wrote ./tmp.CG3tBj8ZFm/chart/olm/templates/0000_90_olm_00-service-monitor.yaml
wrote ./tmp.CG3tBj8ZFm/chart/olm/templates/0000_90_olm_00-service-monitor.yaml

realpath: illegal option -- -
usage: realpath [-q] [path ...]
realpath: illegal option -- -
usage: realpath [-q] [path ...]
realpath: illegal option -- -
usage: realpath [-q] [path ...]
realpath: illegal option -- -
usage: realpath [-q] [path ...]
realpath: illegal option -- -
usage: realpath [-q] [path ...]
realpath: illegal option -- -
usage: realpath [-q] [path ...]
realpath: illegal option -- -
usage: realpath [-q] [path ...]
realpath: illegal option -- -
usage: realpath [-q] [path ...]
realpath: illegal option -- -
usage: realpath [-q] [path ...]
realpath: illegal option -- -
usage: realpath [-q] [path ...]
realpath: illegal option -- -
usage: realpath [-q] [path ...]
realpath: illegal option -- -
usage: realpath [-q] [path ...]
realpath: illegal option -- -
usage: realpath [-q] [path ...]
realpath: illegal option -- -
usage: realpath [-q] [path ...]
realpath: illegal option -- -
usage: realpath [-q] [path ...]
realpath: illegal option -- -
usage: realpath [-q] [path ...]
realpath: illegal option -- -
usage: realpath [-q] [path ...]
realpath: illegal option -- -
usage: realpath [-q] [path ...]
realpath: illegal option -- -
usage: realpath [-q] [path ...]
realpath: illegal option -- -
usage: realpath [-q] [path ...]
realpath: illegal option -- -
usage: realpath [-q] [path ...]
realpath: illegal option -- -
usage: realpath [-q] [path ...]
/Library/Developer/CommandLineTools/usr/bin/make diff
git diff --stat HEAD --ignore-submodules --exit-code
 microshift-manifests/kustomization.yaml | 44 ++++++++++++++++++++++----------------------
 1 file changed, 22 insertions(+), 22 deletions(-)
make[2]: *** [diff] Error 1
make[1]: *** [verify-manifests] Error 2
make: *** [verify] Error 2

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the instructions on https://operator-framework.github.io/operator-controller/contribute/developer/#special-setup-for-macos are followed, this error does not occur on macOS.

local base="$1"
local target="$2"
local base_abs target_abs
local rel=""

base_abs=$(cd "${base}" && pwd -P)
target_abs=$(cd "$(dirname "${target}")" && pwd -P)/$(basename "${target}")

IFS='/' read -r -a base_parts <<< "${base_abs}"
IFS='/' read -r -a target_parts <<< "${target_abs}"

local i=0
local max_common=${#base_parts[@]}
if [ ${#target_parts[@]} -lt ${max_common} ]; then
max_common=${#target_parts[@]}
fi

while [ $i -lt ${max_common} ] && [ "${base_parts[$i]}" = "${target_parts[$i]}" ]; do
i=$((i + 1))
done

local j=$i
while [ $j -lt ${#base_parts[@]} ]; do
if [ -n "${base_parts[$j]}" ]; then
if [ -z "${rel}" ]; then
rel=".."
else
rel="../${rel}"
fi
fi
j=$((j + 1))
done

if [ -z "${rel}" ]; then
rel="."
fi

while [ $i -lt ${#target_parts[@]} ]; do
if [ -n "${target_parts[$i]}" ]; then
if [ "${rel}" = "." ]; then
rel="${target_parts[$i]}"
else
rel="${rel}/${target_parts[$i]}"
fi
fi
i=$((i + 1))
done

printf '%s\n' "${rel}"
}

# OSX distrubtions do not include GNU sed by default, the test below
# exits if we detect that the the insert command is not supported by
# the sed exectuable.
Expand Down Expand Up @@ -614,7 +669,7 @@ for file in ${microshift_manifests_files}; do
continue 2
fi
done
echo " - $(realpath --relative-to "${ROOT_DIR}/microshift-manifests" "${file}")" >> "${ROOT_DIR}/microshift-manifests/kustomization.yaml"
echo " - $(relpath "${ROOT_DIR}/microshift-manifests" "${file}")" >> "${ROOT_DIR}/microshift-manifests/kustomization.yaml"
done

# Now we need to get rid of these args from the olm-operator deployment:
Expand Down