github.com/argoproj/argo-cd/v2@v2.10.9/hack/update-codegen.sh (about)

     1  #!/bin/bash
     2  
     3  # Copyright 2017 The Kubernetes Authors.
     4  #
     5  # Licensed under the Apache License, Version 2.0 (the "License");
     6  # you may not use this file except in compliance with the License.
     7  # You may obtain a copy of the License at
     8  #
     9  #     http://www.apache.org/licenses/LICENSE-2.0
    10  #
    11  # Unless required by applicable law or agreed to in writing, software
    12  # distributed under the License is distributed on an "AS IS" BASIS,
    13  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14  # See the License for the specific language governing permissions and
    15  # limitations under the License.
    16  
    17  set -x
    18  set -o errexit
    19  set -o nounset
    20  set -o pipefail
    21  
    22  PROJECT_ROOT=$(cd $(dirname ${BASH_SOURCE})/..; pwd)
    23  PATH="${PROJECT_ROOT}/dist:${PATH}"
    24  
    25  TARGET_SCRIPT=/tmp/generate-groups.sh
    26  
    27  # codegen utilities are installed outside of generate-groups.sh so remove the `go install` step in the script.
    28  sed -e '/go install/d' ${PROJECT_ROOT}/vendor/k8s.io/code-generator/generate-groups.sh > ${TARGET_SCRIPT}
    29  
    30  # generate-groups.sh assumes codegen utilities are installed to GOBIN, but we just ensure the CLIs
    31  # are in the path and invoke them without assumption of their location
    32  sed -i.bak -e 's#${gobin}/##g' ${TARGET_SCRIPT}
    33  
    34  [ -e ./v2 ] || ln -s . v2
    35  bash -x ${TARGET_SCRIPT} "deepcopy,client,informer,lister" \
    36    github.com/argoproj/argo-cd/v2/pkg/client github.com/argoproj/argo-cd/v2/pkg/apis \
    37    "application:v1alpha1" \
    38    --go-header-file ${PROJECT_ROOT}/hack/custom-boilerplate.go.txt
    39  [ -e ./v2 ] && rm -rf v2