fix: Address shellcheck detected shell warnings (#22686)

Signed-off-by: Oliver Gondža <ogondza@gmail.com>
This commit is contained in:
Oliver Gondža
2025-07-18 13:38:27 +02:00
committed by GitHub
parent 908c73255e
commit 5ee35ad707
38 changed files with 170 additions and 149 deletions

View File

@@ -339,7 +339,7 @@ jobs:
- uses: actions/checkout@8410ad0602e1e429cee44a835ae9f77f654a6694 # v4.0.0 - uses: actions/checkout@8410ad0602e1e429cee44a835ae9f77f654a6694 # v4.0.0
- run: | - run: |
sudo apt-get install shellcheck sudo apt-get install shellcheck
shellcheck -e SC2086 -e SC2046 -e SC2068 -e SC2206 -e SC2048 -e SC2059 -e SC2154 -e SC2034 -e SC2016 -e SC2128 -e SC1091 -e SC2207 $(find . -type f -name '*.sh') | tee sc.log shellcheck -e SC2059 -e SC2154 -e SC2034 -e SC2016 -e SC1091 $(find . -type f -name '*.sh' | grep -v './ui/node_modules') | tee sc.log
test ! -s sc.log test ! -s sc.log
analyze: analyze:

View File

@@ -3,7 +3,7 @@
# If we're started as PID 1, we should wrap command execution through tini to # If we're started as PID 1, we should wrap command execution through tini to
# prevent leakage of orphaned processes ("zombies"). # prevent leakage of orphaned processes ("zombies").
if test "$$" = "1"; then if test "$$" = "1"; then
exec tini -- $@ exec tini -- "$@"
else else
exec "$@" exec "$@"
fi fi

View File

@@ -4,29 +4,31 @@
# Get the current version from go.mod. # Get the current version from go.mod.
CURRENT_VERSION=$(grep 'module github.com/argoproj/argo-cd' go.mod | awk '{print $2}' | sed 's/.*\/v//') CURRENT_VERSION=$(grep 'module github.com/argoproj/argo-cd' go.mod | awk '{print $2}' | sed 's/.*\/v//')
NEXT_VERSION=$((CURRENT_VERSION + 1))
echo "Upgrading from v${CURRENT_VERSION} to v$((CURRENT_VERSION + 1))..." echo "Upgrading from v${CURRENT_VERSION} to v${NEXT_VERSION}..."
# sed commands in this script use -i.bak for compatibility with both GNU sed and BSD sed. # sed commands in this script use -i.bak for compatibility with both GNU sed and BSD sed.
for file in .golangci.yaml .goreleaser.yaml .mockery.yaml Makefile Procfile; do for file in .golangci.yaml .goreleaser.yaml .mockery.yaml Makefile Procfile; do
echo "Incrementing the major version in $file..." echo "Incrementing the major version in $file..."
sed -i.bak "s/github\.com\/argoproj\/argo-cd\/v${CURRENT_VERSION}/github\.com\/argoproj\/argo-cd\/v$((CURRENT_VERSION + 1))/g" "$file" && echo " Updated $file" && rm "$file.bak" sed -i.bak "s~github\.com/argoproj/argo-cd/v${CURRENT_VERSION}~github\.com/argoproj/argo-cd/v${NEXT_VERSION}~g" "$file" && echo " Updated $file" && rm "$file.bak"
done done
for file in hack/generate-proto.sh hack/update-codegen.sh hack/update-openapi.sh; do for file in hack/generate-proto.sh hack/update-codegen.sh hack/update-openapi.sh; do
echo "Incrementing the major version in $file..." echo "Incrementing the major version in $file..."
sed -i.bak "s/v${CURRENT_VERSION}/v$((CURRENT_VERSION + 1))/g" "$file" && echo " Update $file" && rm "$file.bak" sed -i.bak "s~v${CURRENT_VERSION}~v${NEXT_VERSION}~g" "$file" && echo " Update $file" && rm "$file.bak"
done done
echo "Incrementing the major version in proto files..." echo "Incrementing the major version in proto files..."
find . -name '*.proto' -not -path "./vendor/*" -not -path "./dist/*" -exec sed -i.bak "s/github\.com\/argoproj\/argo-cd\/v${CURRENT_VERSION}/github\.com\/argoproj\/argo-cd\/v$((CURRENT_VERSION + 1))/g" {} \; -exec echo " Updated" {} \; -exec rm {}.bak \; find . -name '*.proto' -not -path "./vendor/*" -not -path "./dist/*" -exec sed -i.bak "s~github\.com/argoproj/argo-cd/v${CURRENT_VERSION}~github\.com/argoproj/argo-cd/v${NEXT_VERSION}~g" {} \; -exec echo " Updated" {} \; -exec rm {}.bak \;
find . -name '*.proto' -not -path "./vendor/*" -not -path "./dist/*" -exec sed -i.bak "s/github\.com\.argoproj\.argo_cd\.v${CURRENT_VERSION}/github\.com\.argoproj\.argo_cd\.v$((CURRENT_VERSION + 1))/g" {} \; -exec echo " Updated" {} \; -exec rm {}.bak \; find . -name '*.proto' -not -path "./vendor/*" -not -path "./dist/*" -exec sed -i.bak "s~github\.com\.argoproj\.argo_cd\.v${CURRENT_VERSION}~github\.com\.argoproj\.argo_cd\.v${NEXT_VERSION}~g" {} \; -exec echo " Updated" {} \; -exec rm {}.bak \;
echo "Incrementing the major version in go files..." echo "Incrementing the major version in go files..."
find . -name '*.go' -not -path "./vendor/*" -not -path "./dist/*" -exec sed -i.bak "s/github\.com\/argoproj\/argo-cd\/v${CURRENT_VERSION}/github\.com\/argoproj\/argo-cd\/v$((CURRENT_VERSION + 1))/g" {} \; -exec echo " Updated" {} \; -exec rm {}.bak \; find . -name '*.go' -not -path "./vendor/*" -not -path "./dist/*" -exec sed -i.bak "s~github\.com/argoproj/argo-cd/v${CURRENT_VERSION}~github\.com/argoproj/argo-cd/v${NEXT_VERSION}~g" {} \; -exec echo " Updated" {} \; -exec rm {}.bak \;
echo "Incrementing the major version in go.mod..." echo "Incrementing the major version in go.mod..."
sed -i.bak "s/github\.com\/argoproj\/argo-cd\/v${CURRENT_VERSION}/github\.com\/argoproj\/argo-cd\/v$((CURRENT_VERSION + 1))/g" go.mod && echo " Updated go.mod" && rm go.mod.bak sed -i.bak "s~github\.com/argoproj/argo-cd/v${CURRENT_VERSION}~github\.com/argoproj/argo-cd/v${NEXT_VERSION}~g" go.mod && echo " Updated go.mod" && rm go.mod.bak
# shellcheck disable=SC2016
echo 'Finished! Now run `make codegen-local && make lint-local && make test-local` to ensure everything is working as expected.' echo 'Finished! Now run `make codegen-local && make lint-local && make test-local` to ensure everything is working as expected.'

View File

@@ -1,3 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
find resource_customizations -name action.lua \
find resource_customizations -name action.lua | sed 's/resource_customizations\/\(.*\)\/actions\/\(.*\)\/action.lua/- [\1\/\2](https:\/\/github.com\/argoproj\/argo-cd\/blob\/master\/resource_customizations\/\1\/actions\/\2\/action.lua)/' | sort | uniq > docs/operator-manual/resource_actions_builtin.md | sed 's~resource_customizations/\(.*\)/actions/\(.*\)/action.lua~- [\1/\2](https://github.com/argoproj/argo-cd/blob/master/resource_customizations/\1/actions/\2/action.lua)~' \
| sort \
| uniq \
> docs/operator-manual/resource_actions_builtin.md

View File

@@ -15,4 +15,4 @@ PATH="${PROJECT_ROOT}/dist:${PATH}"
# output tool versions # output tool versions
mockery version mockery version
mockery --config ${PROJECT_ROOT}/.mockery.yaml mockery --config "${PROJECT_ROOT}"/.mockery.yaml

View File

@@ -2,13 +2,13 @@
declare -a services=("controller" "api-server" "redis" "repo-server" "cmp-server" "ui" "applicationset-controller" "commit-server" "notification" "dex" "git-server" "helm-registry" "dev-mounter") declare -a services=("controller" "api-server" "redis" "repo-server" "cmp-server" "ui" "applicationset-controller" "commit-server" "notification" "dex" "git-server" "helm-registry" "dev-mounter")
EXCLUDE=$exclude EXCLUDE="$exclude"
declare -a servicesToRun=() declare -a servicesToRun=()
if [ "$EXCLUDE" != "" ]; then if [ "$EXCLUDE" != "" ]; then
# Parse services list by ',' character # Split services list by ',' character
servicesToExclude=($(echo "$EXCLUDE" | tr ',' '\n')) readarray -t servicesToExclude < <(tr ',' '\n' <<< "$EXCLUDE")
# Find subset of items from services array that not include servicesToExclude items # Find subset of items from services array that not include servicesToExclude items
for element in "${services[@]}" for element in "${services[@]}"
@@ -21,17 +21,16 @@ if [ "$EXCLUDE" != "" ]; then
fi fi
done done
if [[ "$found" == false ]]; then if [[ "$found" == false ]]; then
servicesToRun+=($element) servicesToRun+=("$element")
fi fi
done done
fi fi
command="goreman start " command=("goreman" "start")
for element in "${servicesToRun[@]}" for element in "${servicesToRun[@]}"
do do
command+=$element command+=("$element")
command+=" "
done done
eval $command "${command[@]}"

View File

@@ -1,19 +1,18 @@
#!/bin/sh #!/bin/sh
# Simple wrapper around gpg to prevent exit code != 0 # Simple wrapper around gpg to prevent exit code != 0
ARGS=$* OUTPUT=$(gpg "$@" 2>&1)
OUTPUT=$(gpg $ARGS 2>&1)
IFS='' IFS=''
RET=$? RET=$?
case "$RET" in case "$RET" in
0) 0)
echo $OUTPUT echo "$OUTPUT"
;; ;;
1) 1)
echo $OUTPUT echo "$OUTPUT"
RET=0 RET=0
;; ;;
*) *)
echo $OUTPUT >&2 echo "$OUTPUT" >&2
;; ;;
esac esac
exit $RET exit $RET

View File

@@ -22,6 +22,6 @@ case "${unameOut}" in
Darwin*) INSTALL_OS=darwin;; Darwin*) INSTALL_OS=darwin;;
esac esac
for product in $*; do for product in "$@"; do
ARCHITECTURE=$ARCHITECTURE INSTALL_OS=$INSTALL_OS "$(dirname $0)/installers/install-${product}.sh" ARCHITECTURE=$ARCHITECTURE INSTALL_OS=$INSTALL_OS "$(dirname "$0")/installers/install-${product}.sh"
done done

View File

@@ -8,12 +8,12 @@ for arch in amd64 arm64 ppc64le s390x; do
checksumfile="helm-v$1-linux-$arch.tar.gz.sha256" checksumfile="helm-v$1-linux-$arch.tar.gz.sha256"
wget "https://get.helm.sh/helm-v$1-linux-$arch.tar.gz.sha256sum" -O "$checksumfile" wget "https://get.helm.sh/helm-v$1-linux-$arch.tar.gz.sha256sum" -O "$checksumfile"
outname="$(git rev-parse --show-toplevel)/hack/installers/checksums/helm-v$1-linux-$arch.tar.gz.sha256" outname="$(git rev-parse --show-toplevel)/hack/installers/checksums/helm-v$1-linux-$arch.tar.gz.sha256"
mv $checksumfile $outname mv "$checksumfile" "$outname"
done done
for arch in amd64 arm64; do for arch in amd64 arm64; do
checksumfile="helm-v$1-darwin-$arch.tar.gz.sha256" checksumfile="helm-v$1-darwin-$arch.tar.gz.sha256"
wget "https://get.helm.sh/helm-v$1-darwin-$arch.tar.gz.sha256sum" -O "$checksumfile" wget "https://get.helm.sh/helm-v$1-darwin-$arch.tar.gz.sha256sum" -O "$checksumfile"
outname="$(git rev-parse --show-toplevel)/hack/installers/checksums/helm-v$1-darwin-$arch.tar.gz.sha256" outname="$(git rev-parse --show-toplevel)/hack/installers/checksums/helm-v$1-darwin-$arch.tar.gz.sha256"
mv $checksumfile $outname mv "$checksumfile" "$outname"
done done

View File

@@ -9,7 +9,7 @@ wget "https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2
while IFS="" read -r line || [ -n "$line" ] while IFS="" read -r line || [ -n "$line" ]
do do
filename=$(echo "$line" | awk -F ' ' '{print $2}' | sed "s#v$1#$1#") filename=$(echo "$line" | awk -F ' ' '{print $2}' | sed "s#v$1#$1#")
test "${line#*windows}" == "$line" && echo "$line" | sed "s#v$1#$1#" > "$filename.sha256" test "${line#*windows}" = "$line" && echo "$line" | sed "s#v$1#$1#" > "$filename.sha256"
done < checksums.txt done < checksums.txt
rm checksums.txt rm checksums.txt

View File

@@ -7,7 +7,7 @@ wget "https://github.com/oras-project/oras/releases/download/v$1/oras_$1_checksu
while IFS="" read -r line || [ -n "$line" ] while IFS="" read -r line || [ -n "$line" ]
do do
filename=$(echo "$line" | awk -F ' ' '{print $2}' | sed "s#v$1#$1#") filename=$(echo "$line" | awk -F ' ' '{print $2}' | sed "s#v$1#$1#")
test "${line#*windows}" == "$line" && echo "$line" | sed "s#v$1#$1#" > "$filename.sha256" test "${line#*windows}" = "$line" && echo "$line" | sed "s#v$1#$1#" > "$filename.sha256"
done < oras_$1_checksums.txt done < "oras_$1_checksums.txt"
rm oras_$1_checksums.txt rm "oras_$1_checksums.txt"

View File

@@ -6,7 +6,7 @@ if test "${TARGET_FILE}" = ""; then
exit 1 exit 1
fi fi
CHKSUM_FILE=$(cd "$(dirname "$0")" && pwd)/checksums/${TARGET_FILE}.sha256 CHKSUM_FILE="$(cd "$(dirname "$0")" && pwd)/checksums/${TARGET_FILE}.sha256"
cd "${DOWNLOADS}" || ( cd "${DOWNLOADS}" || (
echo "Can't change directory to ${DOWNLOAD}" >&2 echo "Can't change directory to ${DOWNLOAD}" >&2
@@ -18,9 +18,9 @@ if ! test -f "${TARGET_FILE}"; then
exit 1 exit 1
fi fi
if ! grep -q "${TARGET_FILE}" ${CHKSUM_FILE}; then if ! grep -q "${TARGET_FILE}" "${CHKSUM_FILE}"; then
echo "No checksum for ${TARGET_FILE} in ${CHKSUM_FILE}" >&2 echo "No checksum for ${TARGET_FILE} in ${CHKSUM_FILE}" >&2
exit 1 exit 1
fi fi
shasum -a 256 -c ${CHKSUM_FILE} shasum -a 256 -c "${CHKSUM_FILE}"

View File

@@ -6,20 +6,20 @@ SRCROOT="$( CDPATH='' cd -- "$(dirname "$0")/../.." && pwd -P )"
# This script installs all our golang-based codegen utility CLIs necessary for codegen. # This script installs all our golang-based codegen utility CLIs necessary for codegen.
# Some dependencies are vendored in go.mod (ones which are actually imported in our codebase). # Some dependencies are vendored in go.mod (ones which are actually imported in our codebase).
# Other dependencies are only used as a CLI and do not need vendoring in go.mod (doing so adds # Other dependencies are only used as a CLI and do not need vendoring in go.mod (doing so adds
# unecessary dependencies to go.mod). We want to maintain a single source of truth for versioning # unnecessary dependencies to go.mod). We want to maintain a single source of truth for versioning
# our binaries (either go.mod or go install <pkg>@<version>), so we use two techniques to install # our binaries (either go.mod or go install <pkg>@<version>), so we use two techniques to install
# our CLIs: # our CLIs:
# 1. For CLIs which are NOT vendored in go.mod, we can run `go install <pkg>@<version>` with an explicit version # 1. For CLIs which are NOT vendored in go.mod, we can run `go install <pkg>@<version>` with an explicit version
# 2. For packages which we *do* vendor in go.mod, we determine version from go.mod followed by `go install` with that version # 2. For packages which we *do* vendor in go.mod, we determine version from go.mod followed by `go install` with that version
go_mod_install() { go_mod_install() {
module=$(go list -f '{{.Module}}' $1 | awk '{print $1}') module=$(go list -f '{{.Module}}' "$1" | awk '{print $1}')
module_version=$(go list -m $module | awk '{print $NF}' | head -1) module_version=$(go list -m "$module" | awk '{print $NF}' | head -1)
go install $1@$module_version go install "$1@$module_version"
} }
# All binaries are compiled into the argo-cd/dist directory, which is added to the PATH during codegen # All binaries are compiled into the argo-cd/dist directory, which is added to the PATH during codegen
export GOBIN="${SRCROOT}/dist" export GOBIN="${SRCROOT}/dist"
mkdir -p $GOBIN mkdir -p "$GOBIN"
# protoc-gen-go* is used to generate <service>.pb.go from .proto files # protoc-gen-go* is used to generate <service>.pb.go from .proto files
# go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28.0 # go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28.0
@@ -53,6 +53,7 @@ go install github.com/go-swagger/go-swagger/cmd/swagger@v0.28.0
# goimports is used to auto-format generated code # goimports is used to auto-format generated code
go install golang.org/x/tools/cmd/goimports@v0.1.8 go install golang.org/x/tools/cmd/goimports@v0.1.8
# mockery is used to generate mock
# renovate: datasource=go packageName=github.com/vektra/mockery/v3 # renovate: datasource=go packageName=github.com/vektra/mockery/v3
MOCKERY_VERSION=3.5.0 MOCKERY_VERSION=3.5.0
go install github.com/vektra/mockery/v3@v${MOCKERY_VERSION} go install github.com/vektra/mockery/v3@v${MOCKERY_VERSION}

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/bin/bash
set -eux -o pipefail set -eux -o pipefail
KUSTOMIZE_VERSION=5.4.3 "$(dirname $0)/../install.sh" helm kustomize protoc KUSTOMIZE_VERSION=5.4.3 "$(dirname "$0")/../install.sh" helm kustomize protoc

View File

@@ -3,11 +3,11 @@ set -eux -o pipefail
# Code from: https://github.com/argoproj/argo-rollouts/blob/f650a1fd0ba7beb2125e1598410515edd572776f/hack/installers/install-dev-tools.sh # Code from: https://github.com/argoproj/argo-rollouts/blob/f650a1fd0ba7beb2125e1598410515edd572776f/hack/installers/install-dev-tools.sh
PROJECT_ROOT=$(cd $(dirname ${BASH_SOURCE})/../..; pwd) PROJECT_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")"/../..; pwd)
INSTALL_PATH="${BIN:-$INSTALL_PATH}" INSTALL_PATH="${BIN:-$INSTALL_PATH}"
INSTALL_PATH="${INSTALL_PATH:-$PROJECT_ROOT/dist}" INSTALL_PATH="${INSTALL_PATH:-$PROJECT_ROOT/dist}"
PATH="${INSTALL_PATH}:${PATH}" PATH="${INSTALL_PATH}:${PATH}"
[ -d $INSTALL_PATH ] || mkdir -p $INSTALL_PATH [ -d "$INSTALL_PATH" ] || mkdir -p "$INSTALL_PATH"
# renovate: datasource=github-releases depName=gotestyourself/gotestsum packageName=gotestyourself/gotestsum # renovate: datasource=github-releases depName=gotestyourself/gotestsum packageName=gotestyourself/gotestsum
GOTESTSUM_VERSION=1.12.3 GOTESTSUM_VERSION=1.12.3
@@ -15,13 +15,13 @@ GOTESTSUM_VERSION=1.12.3
OS=$(go env GOOS) OS=$(go env GOOS)
ARCH=$(go env GOARCH) ARCH=$(go env GOARCH)
export TARGET_FILE=gotestsum_${GOTESTSUM_VERSION}_${OS}_${ARCH}.tar.gz export TARGET_FILE="gotestsum_${GOTESTSUM_VERSION}_${OS}_${ARCH}.tar.gz"
temp_path="/tmp/${TARGET_FILE}" temp_path="/tmp/${TARGET_FILE}"
url=https://github.com/gotestyourself/gotestsum/releases/download/v${GOTESTSUM_VERSION}/gotestsum_${GOTESTSUM_VERSION}_${OS}_${ARCH}.tar.gz url="https://github.com/gotestyourself/gotestsum/releases/download/v${GOTESTSUM_VERSION}/gotestsum_${GOTESTSUM_VERSION}_${OS}_${ARCH}.tar.gz"
[ -e ${temp_path} ] || curl -sLf --retry 3 -o ${temp_path} ${url} [ -e "${temp_path}" ] || curl -sLf --retry 3 -o "${temp_path}" "${url}"
mkdir -p /tmp/gotestsum-${GOTESTSUM_VERSION} mkdir -p /tmp/gotestsum-${GOTESTSUM_VERSION}
tar -xvzf ${temp_path} -C /tmp/gotestsum-${GOTESTSUM_VERSION} tar -xvzf "${temp_path}" -C /tmp/gotestsum-${GOTESTSUM_VERSION}
sudo cp /tmp/gotestsum-${GOTESTSUM_VERSION}/gotestsum ${INSTALL_PATH}/gotestsum sudo cp /tmp/gotestsum-${GOTESTSUM_VERSION}/gotestsum "${INSTALL_PATH}/gotestsum"
sudo chmod +x ${INSTALL_PATH}/gotestsum sudo chmod +x "${INSTALL_PATH}/gotestsum"
gotestsum --version gotestsum --version

View File

@@ -1,12 +1,12 @@
#!/bin/bash #!/bin/bash
set -eux -o pipefail set -eux -o pipefail
. $(dirname $0)/../tool-versions.sh . "$(dirname "$0")"/../tool-versions.sh
export TARGET_FILE=helm-v${helm3_version}-${INSTALL_OS}-${ARCHITECTURE}.tar.gz export TARGET_FILE=helm-v${helm3_version}-${INSTALL_OS}-${ARCHITECTURE}.tar.gz
[ -e $DOWNLOADS/${TARGET_FILE} ] || curl -sLf --retry 3 -o $DOWNLOADS/${TARGET_FILE} https://get.helm.sh/helm-v${helm3_version}-$INSTALL_OS-$ARCHITECTURE.tar.gz [ -e "$DOWNLOADS/${TARGET_FILE}" ] || curl -sLf --retry 3 -o "$DOWNLOADS/${TARGET_FILE}" "https://get.helm.sh/helm-v${helm3_version}-$INSTALL_OS-$ARCHITECTURE.tar.gz"
$(dirname $0)/compare-chksum.sh "$(dirname "$0")"/compare-chksum.sh
mkdir -p /tmp/helm && tar -C /tmp/helm -xf $DOWNLOADS/${TARGET_FILE} mkdir -p /tmp/helm && tar -C /tmp/helm -xf "$DOWNLOADS/${TARGET_FILE}"
sudo install -m 0755 /tmp/helm/$INSTALL_OS-$ARCHITECTURE/helm $BIN/helm sudo install -m 0755 "/tmp/helm/$INSTALL_OS-$ARCHITECTURE/helm" "$BIN/helm"
helm version --client helm version --client

View File

@@ -1,17 +1,19 @@
#!/bin/bash #!/bin/bash
set -eux -o pipefail set -eux -o pipefail
. $(dirname $0)/../tool-versions.sh PROJECT_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")"/../..; pwd)
INSTALLERS=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd)
. "$INSTALLERS/../tool-versions.sh"
PROJECT_ROOT=$(cd $(dirname ${BASH_SOURCE})/../..; pwd)
INSTALL_PATH="${BIN:-$INSTALL_PATH}" INSTALL_PATH="${BIN:-$INSTALL_PATH}"
INSTALL_PATH="${INSTALL_PATH:-$PROJECT_ROOT/dist}" INSTALL_PATH="${INSTALL_PATH:-$PROJECT_ROOT/dist}"
PATH="${INSTALL_PATH}:${PATH}" PATH="${INSTALL_PATH}:${PATH}"
[ -d $INSTALL_PATH ] || mkdir -p $INSTALL_PATH [ -d "$INSTALL_PATH" ] || mkdir -p "$INSTALL_PATH"
KUSTOMIZE_VERSION=${KUSTOMIZE_VERSION:-$kustomize5_version} KUSTOMIZE_VERSION=${KUSTOMIZE_VERSION:-$kustomize5_version}
if [ -z $INSTALL_OS ]; then if [ -z "$INSTALL_OS" ]; then
echo "install kustomize error: unsupported operating system" echo "install kustomize error: unsupported operating system"
exit 1 exit 1
fi fi
@@ -27,10 +29,10 @@ case $ARCHITECTURE in
export TARGET_FILE=kustomize_${KUSTOMIZE_VERSION}_${INSTALL_OS}_${ARCHITECTURE}.tar.gz export TARGET_FILE=kustomize_${KUSTOMIZE_VERSION}_${INSTALL_OS}_${ARCHITECTURE}.tar.gz
URL=https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/v${KUSTOMIZE_VERSION}/kustomize_v${KUSTOMIZE_VERSION}_${INSTALL_OS}_$ARCHITECTURE.tar.gz URL=https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/v${KUSTOMIZE_VERSION}/kustomize_v${KUSTOMIZE_VERSION}_${INSTALL_OS}_$ARCHITECTURE.tar.gz
BINNAME=kustomize BINNAME=kustomize
[ -e ${DOWNLOADS}/${TARGET_FILE} ] || curl -sLf --retry 3 -o ${DOWNLOADS}/${TARGET_FILE} "$URL" [ -e "${DOWNLOADS}/${TARGET_FILE}" ] || curl -sLf --retry 3 -o "${DOWNLOADS}/${TARGET_FILE}" "$URL"
$(dirname $0)/compare-chksum.sh "$INSTALLERS/compare-chksum.sh"
tar -C /tmp -xf ${DOWNLOADS}/${TARGET_FILE} tar -C /tmp -xf "${DOWNLOADS}/${TARGET_FILE}"
sudo install -m 0755 /tmp/kustomize $INSTALL_PATH/$BINNAME sudo install -m 0755 /tmp/kustomize "$INSTALL_PATH/$BINNAME"
;; ;;
*) *)
case $KUSTOMIZE_VERSION in case $KUSTOMIZE_VERSION in
@@ -38,21 +40,21 @@ case $ARCHITECTURE in
export TARGET_FILE=kustomize_${KUSTOMIZE_VERSION}_${INSTALL_OS}_${ARCHITECTURE} export TARGET_FILE=kustomize_${KUSTOMIZE_VERSION}_${INSTALL_OS}_${ARCHITECTURE}
URL=https://github.com/kubernetes-sigs/kustomize/releases/download/v${KUSTOMIZE_VERSION}/kustomize_${KUSTOMIZE_VERSION}_${INSTALL_OS}_$ARCHITECTURE URL=https://github.com/kubernetes-sigs/kustomize/releases/download/v${KUSTOMIZE_VERSION}/kustomize_${KUSTOMIZE_VERSION}_${INSTALL_OS}_$ARCHITECTURE
BINNAME=kustomize2 BINNAME=kustomize2
[ -e ${DOWNLOADS}/${TARGET_FILE} ] || curl -sLf --retry 3 -o ${DOWNLOADS}/${TARGET_FILE} "$URL" [ -e "${DOWNLOADS}/${TARGET_FILE}" ] || curl -sLf --retry 3 -o "${DOWNLOADS}/${TARGET_FILE}" "$URL"
$(dirname $0)/compare-chksum.sh "$INSTALLERS/compare-chksum.sh"
sudo install -m 0755 ${DOWNLOADS}/${TARGET_FILE} $INSTALL_PATH/$BINNAME sudo install -m 0755 "${DOWNLOADS}/${TARGET_FILE}" "$INSTALL_PATH/$BINNAME"
;; ;;
*) *)
export TARGET_FILE=kustomize_${KUSTOMIZE_VERSION}_${INSTALL_OS}_${ARCHITECTURE}.tar.gz export TARGET_FILE=kustomize_${KUSTOMIZE_VERSION}_${INSTALL_OS}_${ARCHITECTURE}.tar.gz
URL=https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/v${KUSTOMIZE_VERSION}/kustomize_v${KUSTOMIZE_VERSION}_${INSTALL_OS}_$ARCHITECTURE.tar.gz URL=https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/v${KUSTOMIZE_VERSION}/kustomize_v${KUSTOMIZE_VERSION}_${INSTALL_OS}_$ARCHITECTURE.tar.gz
BINNAME=kustomize BINNAME=kustomize
[ -e ${DOWNLOADS}/${TARGET_FILE} ] || curl -sLf --retry 3 -o ${DOWNLOADS}/${TARGET_FILE} "$URL" [ -e "${DOWNLOADS}/${TARGET_FILE}" ] || curl -sLf --retry 3 -o "${DOWNLOADS}/${TARGET_FILE}" "$URL"
$(dirname $0)/compare-chksum.sh "$INSTALLERS/compare-chksum.sh"
tar -C /tmp -xf ${DOWNLOADS}/${TARGET_FILE} tar -C /tmp -xf "${DOWNLOADS}/${TARGET_FILE}"
sudo install -m 0755 /tmp/kustomize $INSTALL_PATH/$BINNAME sudo install -m 0755 /tmp/kustomize "$INSTALL_PATH/$BINNAME"
;; ;;
esac esac
;; ;;
esac esac
$BINNAME version "$BINNAME" version

View File

@@ -1,11 +1,11 @@
#!/bin/bash #!/bin/bash
set -eux -o pipefail set -eux -o pipefail
PROJECT_ROOT=$(cd $(dirname ${BASH_SOURCE})/../..; pwd) PROJECT_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")"/../..; pwd)
DIST_PATH="${PROJECT_ROOT}/dist" DIST_PATH="${PROJECT_ROOT}/dist"
PATH="${DIST_PATH}:${PATH}" PATH="${DIST_PATH}:${PATH}"
. $(dirname $0)/../tool-versions.sh . "$(dirname "$0")"/../tool-versions.sh
OS=$(go env GOOS) OS=$(go env GOOS)
case $OS in case $OS in
@@ -34,14 +34,20 @@ case $OS in
;; ;;
esac esac
export TARGET_FILE=protoc-${protoc_version}-${protoc_os}-${protoc_arch}.zip export TARGET_FILE="protoc-${protoc_version}-${protoc_os}-${protoc_arch}.zip"
url=https://github.com/protocolbuffers/protobuf/releases/download/v${protoc_version}/protoc-${protoc_version}-${protoc_os}-${protoc_arch}.zip url="https://github.com/protocolbuffers/protobuf/releases/download/v${protoc_version}/protoc-${protoc_version}-${protoc_os}-${protoc_arch}.zip"
[ -e $DOWNLOADS/${TARGET_FILE} ] || curl -sLf --retry 3 -o $DOWNLOADS/${TARGET_FILE} ${url} [ -e "$DOWNLOADS/${TARGET_FILE}" ] || curl -sLf --retry 3 -o "$DOWNLOADS/${TARGET_FILE}" "${url}"
$(dirname $0)/compare-chksum.sh "$(dirname "$0")"/compare-chksum.sh
mkdir -p /tmp/protoc-${protoc_version} mkdir -p "/tmp/protoc-${protoc_version}"
unzip -o $DOWNLOADS/${TARGET_FILE} -d /tmp/protoc-${protoc_version} unzip -o "$DOWNLOADS/${TARGET_FILE}" -d "/tmp/protoc-${protoc_version}"
mkdir -p ${DIST_PATH}/protoc-include mkdir -p "${DIST_PATH}/protoc-include"
sudo install -m 0755 /tmp/protoc-${protoc_version}/bin/protoc ${DIST_PATH}/protoc sudo install -m 0755 "/tmp/protoc-${protoc_version}/bin/protoc" "${DIST_PATH}/protoc"
(cd /tmp/protoc-${protoc_version}/include/ && find -- * -type d -exec install -m 0755 -d "${DIST_PATH}/protoc-include/{}" \;) (
(cd /tmp/protoc-${protoc_version}/include/ && find -- * -type f -exec install -m 0644 "/tmp/protoc-${protoc_version}/include/{}" "${DIST_PATH}/protoc-include/{}" \;) cd "/tmp/protoc-${protoc_version}/include/"
find -- * -type d -exec install -m 0755 -d "${DIST_PATH}/protoc-include/{}" \;
)
(
cd "/tmp/protoc-${protoc_version}/include/"
find -- * -type f -exec install -m 0644 "/tmp/protoc-${protoc_version}/include/{}" "${DIST_PATH}/protoc-include/{}" \;
)
protoc --version protoc --version

View File

@@ -7,14 +7,14 @@ images=$(grep 'image: ' manifests/install.yaml manifests/namespace-install.yaml
failed=false failed=false
while IFS= read -r image; do while IFS= read -r image; do
extra_args="" extra_args=()
if echo "$image" | grep "argocd"; then if echo "$image" | grep "argocd"; then
# Pass the file arg only for the Argo CD image. The file arg also gives us access to sarif output. # Pass the file arg only for the Argo CD image. The file arg also gives us access to sarif output.
extra_args="--file=Dockerfile --sarif-file-output=/tmp/argocd-image.sarif" extra_args+=("--file=Dockerfile" "--sarif-file-output=/tmp/argocd-image.sarif")
fi fi
set -x set -x
if ! snyk container test "$image" --org=argoproj --severity-threshold=high $extra_args; then if ! snyk container test "$image" --org=argoproj --severity-threshold=high "${extra_args[@]}"; then
failed=true failed=true
fi fi
set +x set +x

View File

@@ -107,15 +107,15 @@ for version in $versions; do
images=$(grep 'image: ' manifests/install.yaml manifests/namespace-install.yaml manifests/ha/install.yaml | sed 's/.*image: //' | sort | uniq) images=$(grep 'image: ' manifests/install.yaml manifests/namespace-install.yaml manifests/ha/install.yaml | sed 's/.*image: //' | sort | uniq)
while IFS= read -r image; do while IFS= read -r image; do
extra_args="" extra_args=()
if echo "$image" | grep "argocd"; then if echo "$image" | grep "argocd"; then
# Pass the file arg only for the Argo CD image. The file arg also gives us access to sarif output. # Pass the file arg only for the Argo CD image. The file arg also gives us access to sarif output.
extra_args="--file=Dockerfile --sarif-file-output=/tmp/${image//[\/:]/_}.sarif " extra_args+=("--file=Dockerfile" "--sarif-file-output=/tmp/${image//[\/:]/_}.sarif")
fi fi
set -x set -x
# || [ $? == 1 ] ignores errors due to vulnerabilities. # || [ $? == 1 ] ignores errors due to vulnerabilities.
snyk container test "$image" --org=argoproj "--json-file-output=/tmp/${image//[\/:]/_}.json" $extra_args || [ $? == 1 ] snyk container test "$image" --org=argoproj "--json-file-output=/tmp/${image//[\/:]/_}.json" "${extra_args[@]}" || [ $? == 1 ]
set +x set +x
snyk-to-html -i "/tmp/${image//[\/:]/_}.json" -o "$argocd_dir/docs/snyk/$version/${image//[\/:]/_}.html" snyk-to-html -i "/tmp/${image//[\/:]/_}.json" -o "$argocd_dir/docs/snyk/$version/${image//[\/:]/_}.html"

View File

@@ -13,6 +13,11 @@ if test "${ARGOCD_TEST_VERBOSE:-}" != ""; then
TEST_FLAGS="$TEST_FLAGS -v" TEST_FLAGS="$TEST_FLAGS -v"
fi fi
mkdir -p $TEST_RESULTS mkdir -p "$TEST_RESULTS"
GODEBUG="tarinsecurepath=0,zipinsecurepath=0" gotestsum --rerun-fails-report=rerunreport.txt --junitfile=$TEST_RESULTS/junit.xml --format=testname --rerun-fails="$RERUN_FAILS" --packages="$PACKAGES" -- -cover $TEST_FLAGS $* # `TEST_FLAGS` cannot be quoted as empty needs to evaluate to 0 arguments.
# `TEST_FLAGS` cannot be turned into array without backward incompatible change of script input
# shellcheck disable=SC2086
GODEBUG="tarinsecurepath=0,zipinsecurepath=0" \
gotestsum --rerun-fails-report=rerunreport.txt --junitfile="$TEST_RESULTS/junit.xml" --format=testname \
--rerun-fails="$RERUN_FAILS" --packages="$PACKAGES" -- -cover $TEST_FLAGS "$@"

View File

@@ -33,7 +33,7 @@ echo ">> Working in release branch '${RELEASE_BRANCH}'"
echo ">> Ensuring release branch is up to date." echo ">> Ensuring release branch is up to date."
# make sure release branch is up to date # make sure release branch is up to date
git pull ${GIT_REMOTE} ${RELEASE_BRANCH} git pull "${GIT_REMOTE}" "${RELEASE_BRANCH}"
# Check for target (version) tag in local repo # Check for target (version) tag in local repo
if git tag -l | grep -q -E "^${NEW_TAG}$"; then if git tag -l | grep -q -E "^${NEW_TAG}$"; then
@@ -42,7 +42,7 @@ if git tag -l | grep -q -E "^${NEW_TAG}$"; then
fi fi
# Check for target (version) tag in remote repo # Check for target (version) tag in remote repo
if git ls-remote ${GIT_REMOTE} refs/tags/${NEW_TAG} | grep -q -E "${NEW_TAG}$"; then if git ls-remote "${GIT_REMOTE}" "refs/tags/${NEW_TAG}" | grep -q -E "${NEW_TAG}$"; then
echo "!! Target version tag '${NEW_TAG}' already exists in remote '${GIT_REMOTE}'" >&2 echo "!! Target version tag '${NEW_TAG}' already exists in remote '${GIT_REMOTE}'" >&2
exit 1 exit 1
fi fi
@@ -50,7 +50,7 @@ fi
echo ">> Creating new release '${NEW_TAG}' by pushing '${NEW_TAG}' to '${GIT_REMOTE}'" echo ">> Creating new release '${NEW_TAG}' by pushing '${NEW_TAG}' to '${GIT_REMOTE}'"
# Create new tag in local repository # Create new tag in local repository
git tag ${NEW_TAG} git tag "${NEW_TAG}"
# Push the new tag to remote repository # Push the new tag to remote repository
git push ${GIT_REMOTE} ${NEW_TAG} git push "${GIT_REMOTE}" "${NEW_TAG}"

View File

@@ -20,7 +20,7 @@ set -o nounset
set -o pipefail set -o pipefail
PROJECT_ROOT=$( PROJECT_ROOT=$(
cd $(dirname ${BASH_SOURCE})/.. cd "$(dirname "${BASH_SOURCE[0]}")"/..
pwd pwd
) )
PATH="${PROJECT_ROOT}/dist:${PATH}" PATH="${PROJECT_ROOT}/dist:${PATH}"
@@ -29,11 +29,12 @@ GOPATH_PROJECT_ROOT="${GOPATH}/src/github.com/argoproj/argo-cd"
TARGET_SCRIPT=kube_codegen.sh TARGET_SCRIPT=kube_codegen.sh
# codegen utilities are installed outside of kube_codegen.sh so remove the `go install` step in the script. # codegen utilities are installed outside kube_codegen.sh so remove the `go install` step in the script.
sed -e '/go install/d' ${PROJECT_ROOT}/vendor/k8s.io/code-generator/kube_codegen.sh >${TARGET_SCRIPT} sed -e '/go install/d' "${PROJECT_ROOT}/vendor/k8s.io/code-generator/kube_codegen.sh" > ${TARGET_SCRIPT}
# generate-groups.sh assumes codegen utilities are installed to GOBIN, but we just ensure the CLIs # generate-groups.sh assumes codegen utilities are installed to GOBIN, but we just ensure the CLIs
# are in the path and invoke them without assumption of their location # are in the path and invoke them without assumption of their location
# shellcheck disable=SC2016
sed -i.bak -e 's#${gobin}/##g' ${TARGET_SCRIPT} sed -i.bak -e 's#${gobin}/##g' ${TARGET_SCRIPT}
[ -e ./v3 ] || ln -s . v3 [ -e ./v3 ] || ln -s . v3

View File

@@ -5,11 +5,14 @@ if [ -z "${1:-}" ]; then
echo "Example usage: ./hack/update-kubernetes-version.sh v1.26.11" echo "Example usage: ./hack/update-kubernetes-version.sh v1.26.11"
exit 1 exit 1
fi fi
VERSION=${1#"v"}
MODS=($( function fetch_mods() {
curl -sS https://raw.githubusercontent.com/kubernetes/kubernetes/v${VERSION}/go.mod | curl -sS "https://raw.githubusercontent.com/kubernetes/kubernetes/v${VERSION}/go.mod" |
sed -n 's|.*k8s.io/\(.*\) => ./staging/src/k8s.io/.*|k8s.io/\1|p' sed -n 's|.*k8s.io/\(.*\) => ./staging/src/k8s.io/.*|k8s.io/\1|p'
)) }
VERSION=${1#"v"}
readarray -t MODS < <(fetch_mods)
for MOD in "${MODS[@]}"; do for MOD in "${MODS[@]}"; do
echo "Updating $MOD..." >&2 echo "Updating $MOD..." >&2
V=$( V=$(

View File

@@ -10,7 +10,7 @@ AUTOGENMSG="# This is an auto-generated file. DO NOT EDIT"
KUSTOMIZE=kustomize KUSTOMIZE=kustomize
[ -f "$SRCROOT/dist/kustomize" ] && KUSTOMIZE="$SRCROOT/dist/kustomize" [ -f "$SRCROOT/dist/kustomize" ] && KUSTOMIZE="$SRCROOT/dist/kustomize"
cd ${SRCROOT}/manifests/ha/base/redis-ha && ./generate.sh cd "${SRCROOT}/manifests/ha/base/redis-ha" && ./generate.sh
IMAGE_NAMESPACE="${IMAGE_NAMESPACE:-quay.io/argoproj}" IMAGE_NAMESPACE="${IMAGE_NAMESPACE:-quay.io/argoproj}"
IMAGE_TAG="${IMAGE_TAG:-}" IMAGE_TAG="${IMAGE_TAG:-}"
@@ -20,7 +20,7 @@ if [ "$IMAGE_TAG" = "" ]; then
branch=$(git rev-parse --abbrev-ref HEAD) branch=$(git rev-parse --abbrev-ref HEAD)
if [[ $branch = release-* ]]; then if [[ $branch = release-* ]]; then
pwd pwd
IMAGE_TAG=v$(cat $SRCROOT/VERSION) IMAGE_TAG=v$(cat "$SRCROOT/VERSION")
fi fi
fi fi
# otherwise, use latest # otherwise, use latest
@@ -29,15 +29,15 @@ if [ "$IMAGE_TAG" = "" ]; then
fi fi
$KUSTOMIZE version $KUSTOMIZE version
which $KUSTOMIZE which "$KUSTOMIZE"
cd ${SRCROOT}/manifests/base && $KUSTOMIZE edit set image quay.io/argoproj/argocd=${IMAGE_NAMESPACE}/argocd:${IMAGE_TAG} cd "${SRCROOT}/manifests/base" && $KUSTOMIZE edit set image "quay.io/argoproj/argocd=${IMAGE_NAMESPACE}/argocd:${IMAGE_TAG}"
cd ${SRCROOT}/manifests/ha/base && $KUSTOMIZE edit set image quay.io/argoproj/argocd=${IMAGE_NAMESPACE}/argocd:${IMAGE_TAG} cd "${SRCROOT}/manifests/ha/base" && $KUSTOMIZE edit set image "quay.io/argoproj/argocd=${IMAGE_NAMESPACE}/argocd:${IMAGE_TAG}"
cd ${SRCROOT}/manifests/core-install && $KUSTOMIZE edit set image quay.io/argoproj/argocd=${IMAGE_NAMESPACE}/argocd:${IMAGE_TAG} cd "${SRCROOT}/manifests/core-install" && $KUSTOMIZE edit set image "quay.io/argoproj/argocd=${IMAGE_NAMESPACE}/argocd:${IMAGE_TAG}"
# Because commit-server is added as a resource outside the base, we have to explicitly set the image override here. # Because commit-server is added as a resource outside the base, we have to explicitly set the image override here.
# If/when commit-server is added to the base, this can be removed. # If/when commit-server is added to the base, this can be removed.
cd ${SRCROOT}/manifests/base/commit-server && $KUSTOMIZE edit set image quay.io/argoproj/argocd=${IMAGE_NAMESPACE}/argocd:${IMAGE_TAG} cd "${SRCROOT}/manifests/base/commit-server" && $KUSTOMIZE edit set image "quay.io/argoproj/argocd=${IMAGE_NAMESPACE}/argocd:${IMAGE_TAG}"
echo "${AUTOGENMSG}" > "${SRCROOT}/manifests/install.yaml" echo "${AUTOGENMSG}" > "${SRCROOT}/manifests/install.yaml"
$KUSTOMIZE build "${SRCROOT}/manifests/cluster-install" >> "${SRCROOT}/manifests/install.yaml" $KUSTOMIZE build "${SRCROOT}/manifests/cluster-install" >> "${SRCROOT}/manifests/install.yaml"
@@ -54,7 +54,7 @@ $KUSTOMIZE build "${SRCROOT}/manifests/ha/namespace-install" >> "${SRCROOT}/mani
echo "${AUTOGENMSG}" > "${SRCROOT}/manifests/core-install.yaml" echo "${AUTOGENMSG}" > "${SRCROOT}/manifests/core-install.yaml"
$KUSTOMIZE build "${SRCROOT}/manifests/core-install" >> "${SRCROOT}/manifests/core-install.yaml" $KUSTOMIZE build "${SRCROOT}/manifests/core-install" >> "${SRCROOT}/manifests/core-install.yaml"
# Copies enabling manifest hydrator. These can be removed once the manifest hydrator is either removed or enabled by # Copies enabling manifest hydrator. These can be removed once the manifest hydrator is either removed or enabled by
# default. # default.
echo "${AUTOGENMSG}" > "${SRCROOT}/manifests/install-with-hydrator.yaml" echo "${AUTOGENMSG}" > "${SRCROOT}/manifests/install-with-hydrator.yaml"

View File

@@ -6,7 +6,7 @@ set -o nounset
set -o pipefail set -o pipefail
PROJECT_ROOT=$( PROJECT_ROOT=$(
cd $(dirname "$0")/.. cd "$(dirname "$0")/.."
pwd pwd
) )
PATH="${PROJECT_ROOT}/dist:${PATH}" PATH="${PROJECT_ROOT}/dist:${PATH}"
@@ -19,11 +19,11 @@ VERSION="v1alpha1"
[ -e "${GOPATH_PROJECT_ROOT}" ] || (mkdir -p "$(dirname "${GOPATH_PROJECT_ROOT}")" && ln -s "${PROJECT_ROOT}" "${GOPATH_PROJECT_ROOT}") [ -e "${GOPATH_PROJECT_ROOT}" ] || (mkdir -p "$(dirname "${GOPATH_PROJECT_ROOT}")" && ln -s "${PROJECT_ROOT}" "${GOPATH_PROJECT_ROOT}")
openapi-gen \ openapi-gen \
--go-header-file ${PROJECT_ROOT}/hack/custom-boilerplate.go.txt \ --go-header-file "${PROJECT_ROOT}/hack/custom-boilerplate.go.txt" \
--output-pkg github.com/argoproj/argo-cd/v3/pkg/apis/application/${VERSION} \ --output-pkg github.com/argoproj/argo-cd/v3/pkg/apis/application/${VERSION} \
--report-filename pkg/apis/api-rules/violation_exceptions.list \ --report-filename pkg/apis/api-rules/violation_exceptions.list \
--output-dir "${GOPATH}/src" \ --output-dir "${GOPATH}/src" \
$@ "$@"
[ -L "${GOPATH_PROJECT_ROOT}" ] && rm -rf "${GOPATH_PROJECT_ROOT}" [ -L "${GOPATH_PROJECT_ROOT}" ] && rm -rf "${GOPATH_PROJECT_ROOT}"
[ -L ./v3 ] && rm -rf v3 [ -L ./v3 ] && rm -rf v3

View File

@@ -4,12 +4,12 @@ set -e
KNOWN_HOSTS_FILE=$(dirname "$0")/ssh_known_hosts KNOWN_HOSTS_FILE=$(dirname "$0")/ssh_known_hosts
HEADER="# This file was automatically generated by hack/update-ssh-known-hosts.sh. DO NOT EDIT" HEADER="# This file was automatically generated by hack/update-ssh-known-hosts.sh. DO NOT EDIT"
echo "$HEADER" > $KNOWN_HOSTS_FILE echo "$HEADER" > "$KNOWN_HOSTS_FILE"
{ \ {
ssh-keyscan github.com gitlab.com bitbucket.org ssh.dev.azure.com vs-ssh.visualstudio.com && \ ssh-keyscan github.com gitlab.com bitbucket.org ssh.dev.azure.com vs-ssh.visualstudio.com
ssh-keyscan -p 443 ssh.github.com ; \ ssh-keyscan -p 443 ssh.github.com
} | sort -u >> $KNOWN_HOSTS_FILE } | sort -u >> "$KNOWN_HOSTS_FILE"
chmod 0644 $KNOWN_HOSTS_FILE chmod 0644 "$KNOWN_HOSTS_FILE"
# Public SSH keys can be verified at the following URLs: # Public SSH keys can be verified at the following URLs:
# - github.com: https://help.github.com/articles/github-s-ssh-key-fingerprints/ # - github.com: https://help.github.com/articles/github-s-ssh-key-fingerprints/
@@ -17,7 +17,7 @@ chmod 0644 $KNOWN_HOSTS_FILE
# - gitlab.com: https://docs.gitlab.com/ee/user/gitlab_com/#ssh-host-keys-fingerprints # - gitlab.com: https://docs.gitlab.com/ee/user/gitlab_com/#ssh-host-keys-fingerprints
# - bitbucket.org: https://confluence.atlassian.com/bitbucket/ssh-keys-935365775.html # - bitbucket.org: https://confluence.atlassian.com/bitbucket/ssh-keys-935365775.html
# - ssh.dev.azure.com, vs-ssh.visualstudio.com: https://docs.microsoft.com/en-us/azure/devops/repos/git/use-ssh-keys-to-authenticate?view=azure-devops # - ssh.dev.azure.com, vs-ssh.visualstudio.com: https://docs.microsoft.com/en-us/azure/devops/repos/git/use-ssh-keys-to-authenticate?view=azure-devops
diff - <(ssh-keygen -l -f $KNOWN_HOSTS_FILE | sort -k 3) <<EOF diff - <(ssh-keygen -l -f "$KNOWN_HOSTS_FILE" | sort -k 3) <<EOF
256 SHA256:p2QAMXNIC1TJYWeIOttrVc98/R1BUFWu3/LiyKgUfQM [ssh.github.com]:443 (ECDSA) 256 SHA256:p2QAMXNIC1TJYWeIOttrVc98/R1BUFWu3/LiyKgUfQM [ssh.github.com]:443 (ECDSA)
256 SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU [ssh.github.com]:443 (ED25519) 256 SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU [ssh.github.com]:443 (ED25519)
3072 SHA256:uNiVztksCsDhcc0u9e8BujQXVUpKZIDTMczCvj3tD2s [ssh.github.com]:443 (RSA) 3072 SHA256:uNiVztksCsDhcc0u9e8BujQXVUpKZIDTMczCvj3tD2s [ssh.github.com]:443 (RSA)

View File

@@ -33,4 +33,4 @@ done
git checkout "release-$argocd_current_version" git checkout "release-$argocd_current_version"
printf "$out" > docs/operator-manual/tested-kubernetes-versions.md echo -en "$out" > docs/operator-manual/tested-kubernetes-versions.md

View File

@@ -2,8 +2,8 @@
set -e set -e
if test "$(id -u)" == "0" -a "${USER_ID}" != ""; then if test "$(id -u)" == "0" -a "${USER_ID}" != ""; then
useradd -u ${USER_ID} -d /home/user -s /bin/bash ${USER_NAME:-default} useradd -u "${USER_ID}" -d /home/user -s /bin/bash "${USER_NAME:-default}"
chown -R "${USER_NAME:-default}" ${GOCACHE} chown -R "${USER_NAME:-default}" "${GOCACHE}"
fi fi
export PATH=$PATH:/usr/local/go/bin:/go/bin export PATH=$PATH:/usr/local/go/bin:/go/bin

View File

@@ -1,12 +1,12 @@
#!/bin/sh #!/bin/sh
# Simple helper script to kill all running processes in the container that # Simple helper script to kill all running processes in the container that
# have belong to the root user. # belong to the root user.
# DO NOT RUN OUTSIDE THE DOCKER CONTAINER EXECUTING ARGO CD TESTS. # DO NOT RUN OUTSIDE THE DOCKER CONTAINER EXECUTING ARGO CD TESTS.
# YOU HAVE BEEN WARNED. # YOU HAVE BEEN WARNED.
somefunc() { cleanup() {
echo "Killing all processes" echo "Killing all processes"
sudo pkill -u root sudo pkill -u root
} }
@@ -16,7 +16,7 @@ if test "${PWD}" != "/go/src/github.com/argoproj/argo-cd"; then
echo "ERROR: We don't seem to be in Docker container. Exit." >&2 echo "ERROR: We don't seem to be in Docker container. Exit." >&2
exit 1 exit 1
fi fi
trap somefunc 2 15 trap cleanup 2 15
while :; do while :; do
sleep 1 sleep 1
done done

View File

@@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
FILE=$(echo "$GIT_SSH_COMMAND" | grep -oP '\-i \K[/\w]+') FILE=$(echo "$GIT_SSH_COMMAND" | grep -oP '\-i \K[/\w]+')
GIT_SSH_CRED_FILE_SHA=$(sha256sum ${FILE}) GIT_SSH_CRED_FILE_SHA=$(sha256sum "${FILE}")
echo "{\"kind\": \"ConfigMap\", \"apiVersion\": \"v1\", \"metadata\": { \"name\": \"$ARGOCD_APP_NAME\", \"namespace\": \"$ARGOCD_APP_NAMESPACE\", \"annotations\": {\"GitSSHCommand\":\"$GIT_SSH_COMMAND\", \"GitSSHCredsFileSHA\":\"$GIT_SSH_CRED_FILE_SHA\"}}}" echo "{\"kind\": \"ConfigMap\", \"apiVersion\": \"v1\", \"metadata\": { \"name\": \"$ARGOCD_APP_NAME\", \"namespace\": \"$ARGOCD_APP_NAMESPACE\", \"annotations\": {\"GitSSHCommand\":\"$GIT_SSH_COMMAND\", \"GitSSHCredsFileSHA\":\"$GIT_SSH_CRED_FILE_SHA\"}}}"

View File

@@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
set -e set -e
FILE=$(echo "$GIT_SSH_COMMAND" | grep -oP '\-i \K[/\w]+') FILE=$(echo "$GIT_SSH_COMMAND" | grep -oP '\-i \K[/\w]+')
GIT_SSH_CRED_FILE_SHA=$(sha256sum ${FILE}) GIT_SSH_CRED_FILE_SHA=$(sha256sum "${FILE}")
echo "{\"kind\": \"ConfigMap\", \"apiVersion\": \"v1\", \"metadata\": { \"name\": \"$ARGOCD_APP_NAME\", \"namespace\": \"$ARGOCD_APP_NAMESPACE\", \"annotations\": {\"GitSSHCommand\":\"$GIT_SSH_COMMAND\", \"GitSSHCredsFileSHA\":\"$GIT_SSH_CRED_FILE_SHA\"}}}" echo "{\"kind\": \"ConfigMap\", \"apiVersion\": \"v1\", \"metadata\": { \"name\": \"$ARGOCD_APP_NAME\", \"namespace\": \"$ARGOCD_APP_NAMESPACE\", \"annotations\": {\"GitSSHCommand\":\"$GIT_SSH_COMMAND\", \"GitSSHCredsFileSHA\":\"$GIT_SSH_CRED_FILE_SHA\"}}}"

View File

@@ -1,5 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
export HELM_EXPERIMENTAL_OCI=1 export HELM_EXPERIMENTAL_OCI=1
docker run -p 5001:5000 --rm --name authed-registry -v $(pwd)/test/fixture/testrepos/.oci-htpasswd:/etc/docker/registry/auth.htpasswd \ docker run -p 5001:5000 --rm --name authed-registry -v "$(pwd)"/test/fixture/testrepos/.oci-htpasswd:/etc/docker/registry/auth.htpasswd \
-e REGISTRY_AUTH="{htpasswd: {realm: localhost, path: /etc/docker/registry/auth.htpasswd}}" \ -e REGISTRY_AUTH="{htpasswd: {realm: localhost, path: /etc/docker/registry/auth.htpasswd}}" \
registry registry

View File

@@ -2,5 +2,5 @@
docker run --name e2e-git --rm -i \ docker run --name e2e-git --rm -i \
-p 2222:2222 -p 9080:9080 -p 9443:9443 -p 9444:9444 -p 9445:9445 \ -p 2222:2222 -p 9080:9080 -p 9443:9443 -p 9444:9444 -p 9445:9445 \
-w /go/src/github.com/argoproj/argo-cd -v $(pwd):/go/src/github.com/argoproj/argo-cd -v /tmp:/tmp docker.io/argoproj/argo-cd-ci-builder:v1.0.0 \ -w /go/src/github.com/argoproj/argo-cd -v "$(pwd)":/go/src/github.com/argoproj/argo-cd -v /tmp:/tmp docker.io/argoproj/argo-cd-ci-builder:v1.0.0 \
bash -c "goreman -f ./test/fixture/testrepos/Procfile start" bash -c "goreman -f ./test/fixture/testrepos/Procfile start"

View File

@@ -2,11 +2,11 @@
set -e set -e
if test "$(id -u)" == "0" -a "${USER_ID}" != ""; then if test "$(id -u)" == "0" -a "${USER_ID}" != ""; then
useradd -u ${USER_ID} -d /home/user -s /bin/bash ${USER_NAME:-default} useradd -u "${USER_ID}" -d /home/user -s /bin/bash "${USER_NAME:-default}"
chown -R "${USER_NAME:-default}" ${GOCACHE} chown -R "${USER_NAME:-default}" "${GOCACHE}"
fi fi
export PATH=$PATH:/usr/local/go/bin:/go/bin export PATH=$PATH:/usr/local/go/bin:/go/bin
export GOROOT=/usr/local/go export GOROOT=/usr/local/go
"$@" "$@"

View File

@@ -1,8 +1,8 @@
#!/bin/sh #!/bin/sh
BASEPATH=$(dirname $0) BASEPATH=$(dirname "$0")
PERMFILE=${BASEPATH}/argocd-remote-permissions.yaml PERMFILE=${BASEPATH}/argocd-remote-permissions.yaml
if ! test -f ${PERMFILE}; then if ! test -f "${PERMFILE}"; then
echo "ERROR: $PERMFILE does not exist." >&2 echo "ERROR: $PERMFILE does not exist." >&2
exit 1 exit 1
fi fi
@@ -27,4 +27,4 @@ sed \
-e "s/##CONTROLLERSANAME##/${CONTROLLERSANAME}/g" \ -e "s/##CONTROLLERSANAME##/${CONTROLLERSANAME}/g" \
-e "s/##SERVERSANAME##/${SERVERSANAME}/g" \ -e "s/##SERVERSANAME##/${SERVERSANAME}/g" \
-e "s/##NAMESPACE##/${NAMESPACE}/g" \ -e "s/##NAMESPACE##/${NAMESPACE}/g" \
$PERMFILE "$PERMFILE"

View File

@@ -17,7 +17,7 @@ export ARGOCD_E2E_DEFAULT_TIMEOUT=30
# Set ARGOCD_E2E_NAMESPACE to the namespace the Argo CD we're testing against is # Set ARGOCD_E2E_NAMESPACE to the namespace the Argo CD we're testing against is
# running in. Defaults to "argocd-e2e" # running in. Defaults to "argocd-e2e"
export ARGOCD_E2E_NAMESPACE=${ARGOCD_E2E_NAMESPACE:-argocd-e2e} export ARGOCD_E2E_NAMESPACE="${ARGOCD_E2E_NAMESPACE:-argocd-e2e}"
# Name prefix the operator sets on resources created for Argo CD instance. This # Name prefix the operator sets on resources created for Argo CD instance. This
# is usually also the name of the instance itself. # is usually also the name of the instance itself.
@@ -29,13 +29,13 @@ export ARGOCD_E2E_K3S=true
# Configuration for skipping certain classes of tests # Configuration for skipping certain classes of tests
# GnuPG features not yet available with GitOps Operator # GnuPG features not yet available with GitOps Operator
export ARGOCD_E2E_SKIP_GPG=${ARGOCD_E2E_SKIP_GPG:-false} export ARGOCD_E2E_SKIP_GPG="${ARGOCD_E2E_SKIP_GPG:-false}"
# Some tests do not work OOTB with OpenShift # Some tests do not work OOTB with OpenShift
export ARGOCD_E2E_SKIP_OPENSHIFT=${ARGOCD_E2E_SKIP_OPENSHIFT:-false} export ARGOCD_E2E_SKIP_OPENSHIFT="${ARGOCD_E2E_SKIP_OPENSHIFT:-false}"
# Skip Helm tests # Skip Helm tests
export ARGOCD_E2E_SKIP_HELM=${ARGOCD_E2E_SKIP_HELM:-false} export ARGOCD_E2E_SKIP_HELM="${ARGOCD_E2E_SKIP_HELM:-false}"
# Skip Ksonnet tests # Skip Ksonnet tests
export ARGOCD_E2E_SKIP_KSONNET=${ARGOCD_E2E_SKIP_KSONNET:-false} export ARGOCD_E2E_SKIP_KSONNET="${ARGOCD_E2E_SKIP_KSONNET:-false}"
## ==================================================== ## ====================================================
# no changes below this line required # no changes below this line required
@@ -50,7 +50,7 @@ export ARGOCD_E2E_HELM_SERVICE="http://127.0.0.1:9081/helm-repo"
export ARGOCD_E2E_GIT_SERVICE_SUBMODULE="http://127.0.0.1:9081/argo-e2e/submodule.git" export ARGOCD_E2E_GIT_SERVICE_SUBMODULE="http://127.0.0.1:9081/argo-e2e/submodule.git"
export ARGOCD_E2E_GIT_SERVICE_SUBMODULE_PARENT="http://127.0.0.1:9081/argo-e2e/submoduleParent.git" export ARGOCD_E2E_GIT_SERVICE_SUBMODULE_PARENT="http://127.0.0.1:9081/argo-e2e/submoduleParent.git"
# URLs used during testing - usually no need to change thos # URLs used during testing - usually no need to change those
export ARGOCD_E2E_REPO_SSH="ssh://root@argocd-e2e-server:2222/tmp/argo-e2e/testdata.git" export ARGOCD_E2E_REPO_SSH="ssh://root@argocd-e2e-server:2222/tmp/argo-e2e/testdata.git"
export ARGOCD_E2E_REPO_SSH_SUBMODULE="ssh://root@argocd-e2e-server:2222/tmp/argo-e2e/submodule.git" export ARGOCD_E2E_REPO_SSH_SUBMODULE="ssh://root@argocd-e2e-server:2222/tmp/argo-e2e/submodule.git"
export ARGOCD_E2E_REPO_SSH_SUBMODULE_PARENT="ssh://root@argocd-e2e-server:2222/tmp/argo-e2e/submoduleParent.git" export ARGOCD_E2E_REPO_SSH_SUBMODULE_PARENT="ssh://root@argocd-e2e-server:2222/tmp/argo-e2e/submoduleParent.git"
@@ -61,4 +61,4 @@ export ARGOCD_E2E_REPO_HTTPS_SUBMODULE_PARENT="https://argocd-e2e-server:9443/ar
export ARGOCD_E2E_REPO_HELM="https://argocd-e2e-server:9444/helm-repo" export ARGOCD_E2E_REPO_HELM="https://argocd-e2e-server:9444/helm-repo"
export ARGOCD_E2E_REPO_DEFAULT="http://argocd-e2e-server:9081/argo-e2e/testdata.git" export ARGOCD_E2E_REPO_DEFAULT="http://argocd-e2e-server:9081/argo-e2e/testdata.git"
$* "$@"

View File

@@ -4,9 +4,9 @@ set -e
TAG=${IMAGE_TAG:-'latest'} TAG=${IMAGE_TAG:-'latest'}
docker build --build-arg ARGO_VERSION=${TAG} -t ${IMAGE_NAMESPACE:-$(whoami)}/argocd-ui:${TAG} . docker build --build-arg ARGO_VERSION="${TAG}" -t "${IMAGE_NAMESPACE:-$(whoami)}/argocd-ui:${TAG}" .
if [ "$DOCKER_PUSH" == "true" ] if [ "$DOCKER_PUSH" == "true" ]
then then
docker push ${IMAGE_NAMESPACE:-$(whoami)}/argocd-ui:${TAG} docker push "${IMAGE_NAMESPACE:-$(whoami)}/argocd-ui:${TAG}"
fi fi