Skip to content

Commit

Permalink
Fix a global-variable problem
Browse files Browse the repository at this point in the history
`TAG` and `IMAGE_TAG` are two different things.
  • Loading branch information
ericpromislow committed Jun 1, 2024
1 parent fdd7890 commit f71cdc3
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 25 deletions.
9 changes: 0 additions & 9 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,6 @@ jobs:
- run : make ci
name: ci

# - name: Build an image for integration testing
# run: ./scripts/package-for-ci
# env:
# ARCH: "${{ matrix.arch }}"
# SHA: "${{ github.sha }}"

- name : install K3d
run : ./.github/workflows/scripts/install-k3d.sh

Expand All @@ -77,9 +71,6 @@ jobs:
RANCHER_IMAGE_TAG: "v2.9-head"
VERSION: "2.9"

- name : debug show image_tag file
run : cat dist/image_tag

- name : get vars
run : cat dist/image_tag >> $GITHUB_ENV

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/scripts/integration-test-ci
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
set -eux
set -eu

cd $(dirname $0)/../../..
DIST_DIR="$PWD"/dist
Expand Down Expand Up @@ -45,7 +45,7 @@ echo "Uploading new webhook image"

# Install the webhook chart we just built.
upgrade_rancher_webhook() {
helm upgrade rancher-webhook ./dist/artifacts/rancher-webhook-${HELM_VERSION}.tgz -n cattle-system \
helm upgrade rancher-webhook ./dist/artifacts/rancher-webhook-${HELM_CHART_VERSION}.tgz -n cattle-system \
--wait --timeout=120s --set image.repository="${IMAGE_REPO}" --set image.tag="${IMAGE_TAG}" --reuse-values --debug
}

Expand All @@ -68,7 +68,7 @@ set -e
./bin/rancher-webhook-integration.test -test.v -test.run IntegrationTest

# Install the webhook chart with new ports.
helm upgrade rancher-webhook ./dist/artifacts/rancher-webhook-${HELM_VERSION}.tgz -n cattle-system \
helm upgrade rancher-webhook ./dist/artifacts/rancher-webhook-${HELM_CHART_VERSION}.tgz -n cattle-system \
--wait --reuse-values --set port=443

# Test that the ports are set as expected and run a single integration test to verify the webhook is still accessible.
Expand Down
4 changes: 2 additions & 2 deletions scripts/integration-test
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ source ./dist/tags

# Install the webhook chart we just built.
upgrade_rancher_webhook() {
helm upgrade rancher-webhook ./dist/artifacts/rancher-webhook-${HELM_VERSION}.tgz -n cattle-system \
helm upgrade rancher-webhook ./dist/artifacts/rancher-webhook-${HELM_CHART_VERSION}.tgz -n cattle-system \
--wait --set image.repository="${IMAGE_REPO}" --set image.tag="${IMAGE_TAG}" --reuse-values --debug
}
try --delay 2 --max 4 --failmsg "Couldn't helm upgrade rancher-webhook" upgrade_rancher_webhook

./bin/rancher-webhook-integration.test -test.v -test.run IntegrationTest

# Install the webhook chart with new ports.
helm upgrade rancher-webhook ./dist/artifacts/rancher-webhook-${HELM_VERSION}.tgz -n cattle-system \
helm upgrade rancher-webhook ./dist/artifacts/rancher-webhook-${HELM_CHART_VERSION}.tgz -n cattle-system \
--wait --reuse-values --set port=443

# Test that the ports are set as expected and run a single integration test to verify the webhook is still accessible.
Expand Down
2 changes: 0 additions & 2 deletions scripts/package
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ set -eu

source $(dirname $0)/version

set -x

cd $(dirname $0)/..

echo Running package
Expand Down
3 changes: 0 additions & 3 deletions scripts/package-for-ci
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ fi

source $(dirname $0)/version

set -x

echo "QQQ: scripts/package: SHA is ${SHA}"
REPO=rancher
IMAGE=${REPO}/webhook:${TAG}
docker tag ${IMAGE} "${REPO}/webhook:${SHA}"
Expand Down
4 changes: 2 additions & 2 deletions scripts/package-helm
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ cp -rf charts build/

# must use sed -i'<backup_extension>'` for GNU and OSX compatibility
sed -i'.bkp' \
-e 's/^version:.*/version: '${HELM_VERSION}'/' \
-e 's/appVersion:.*/appVersion: '${HELM_VERSION}'/' \
-e 's/^version:.*/version: '${HELM_CHART_VERSION}'/' \
-e 's/appVersion:.*/appVersion: '${HELM_CHART_VERSION}'/' \
build/charts/rancher-webhook/Chart.yaml

sed -i'.bkb' \
Expand Down
1 change: 0 additions & 1 deletion scripts/test-helm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
set -e
cd $(dirname $0)/..

./scripts/package-helm
echo Running helm lint
helm lint ./charts/rancher-webhook
# Check for unittest plugin
Expand Down
6 changes: 3 additions & 3 deletions scripts/version
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ fi
SUFFIX="-${ARCH}"

HELM_TAG="${HELM_TAG:-${TAG:-${VERSION}}}"
HELM_VERSION="${HELM_VERSION:-${HELM_TAG/v/}}"
HELM_CHART_VERSION="${HELM_CHART_VERSION:-${HELM_TAG/v/}}"
TAG="${TAG:-${VERSION}${SUFFIX}}"
REPO="${REPO:-rancher}"

if echo $TAG | grep -q dirty; then
TAG=dev
HELM_TAG=dev
HELM_VERSION=0.0.0-dev
HELM_CHART_VERSION=0.0.0-dev
fi

DIST_DIR="${DIST_DIR:-$(dirname $0)/../dist/}"
mkdir -p ${DIST_DIR}
echo "export TAG=${TAG}; export HELM_TAG=${HELM_TAG}; export HELM_VERSION=${HELM_VERSION};" >${DIST_DIR}/tags
echo "export TAG=${TAG}; export HELM_TAG=${HELM_TAG}; export HELM_CHART_VERSION=${HELM_CHART_VERSION};" >${DIST_DIR}/tags

0 comments on commit f71cdc3

Please sign in to comment.