Skip to content
Open
Show file tree
Hide file tree
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
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,16 @@ bundle-build: ## Build the bundle image.
bundle-push: ## Push the bundle image.
$(MAKE) docker-push IMG=$(BUNDLE_IMG)

ARGOCD_OPERATOR_BRANCH ?= master

# To run propagate-manifests target with the default argocd-operator master branch:
# make propagate-manifests
# To run propagate-manifests target with a custom argocd-operator branch or tag:
# ARGOCD_OPERATOR_BRANCH=release-0.19 make propagate-manifests
.PHONY: propagate-manifests
propagate-manifests: ## compare and propagate manifests from argocd-operator repo
./hack/propagate.sh --from-branch $(ARGOCD_OPERATOR_BRANCH)

.PHONY: opm
OPM = ./bin/opm
opm: ## Download opm locally if necessary.
Expand Down
40 changes: 36 additions & 4 deletions hack/propagate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,34 @@

set -e

FROM_BRANCH="master"
SKIP_MAKE=false

usage() {
echo "Usage: $0 [--from-branch <branch>] [--skip-make]"
echo ""
echo "Options:"
echo " --from-branch <branch> argocd-operator repo branch or tag to source manifests from (default: master)"
echo " --skip-make skip running 'make bundle' after copying changed files (default: false)"
exit 1
}

while [[ $# -gt 0 ]]; do
case "$1" in
--from-branch)
FROM_BRANCH="$2"
shift 2
;;
--skip-make)
SKIP_MAKE=true
shift
;;
*)
usage
;;
esac
done

trap cleanup EXIT

function cleanup {
Expand All @@ -11,7 +39,7 @@ function cleanup {

mkdir -p /tmp/argocd-operator-hack

git clone https://github.com/argoproj-labs/argocd-operator.git /tmp/argocd-operator-hack/
git clone --depth 1 --branch "$FROM_BRANCH" --single-branch --no-tags https://github.com/argoproj-labs/argocd-operator.git /tmp/argocd-operator-hack/

changedFiles=$(diff -qr /tmp/argocd-operator-hack/config/crd/bases/ ../config/crd/bases/ | grep -v argoproj.io_argocdexports.yaml | grep differ | awk -F ' ' '{print $2}')

Expand All @@ -22,7 +50,11 @@ if [ -z "$changedFiles" ]
then
echo "No difference found"
else
cp ${changedFiles} ../config/crd/bases/
cd ..
make bundle
cp ${changedFiles} ../config/crd/bases/
if [ "$SKIP_MAKE" = false ]; then
cd ..
make bundle
else
echo "Skipping 'make bundle' (--skip-make specified)"
fi
fi