You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by GitBox <gi...@apache.org> on 2022/03/08 20:48:49 UTC

[GitHub] [solr-operator] janhoy commented on a change in pull request #411: Add operator version & ArgoCD annotations to CRDs

janhoy commented on a change in pull request #411:
URL: https://github.com/apache/solr-operator/pull/411#discussion_r822058570



##########
File path: hack/config/add_crds_annotations.sh
##########
@@ -0,0 +1,37 @@
+#!/usr/bin/env bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+
+# exit immediately when a command fails
+set -e
+# only exit with zero if all commands of the pipeline exit successfully
+set -o pipefail
+# error on unset variables
+set -u
+
+echo "Add annotations to CRDs"
+
+rm -f "${CONFIG_DIRECTORY:-config}"/crd/bases/*.tmp
+
+files=("${CONFIG_DIRECTORY:-config}"/crd/bases/*)
+
+# Copy and package CRDs
+for file in "${files[@]}"; do
+  {
+    cat "${file}" | sed -e "/^    controller-gen.kubebuilder.io.version.*/a \\
+    operator.solr.apache.org\\/version: ${VERSION}\\
+    argocd.argoproj.io\\/sync-options: Replace=true"
+  } > "${file}.tmp" && mv "${file}.tmp" "${file}"

Review comment:
       `sed -i` would do it in-place but may not work on some OSes




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org