diff --git a/.github/actions/build-images/agent/action.yml b/.github/actions/build-images/agent/action.yml index c736e8a4b..678f46c99 100644 --- a/.github/actions/build-images/agent/action.yml +++ b/.github/actions/build-images/agent/action.yml @@ -9,11 +9,6 @@ runs: if [[ "$ARCH" == "x64" ]]; then echo "ARCH=amd64" >> $GITHUB_ENV fi - - name: install yq - uses: ./.github/actions/install-yq - with: - arch: ${{ env.ARCH }} - use-sudo: true - id: env name: Setup Dependencies Env Variables uses: ./.github/actions/setup-build-env diff --git a/.github/actions/build-images/server/action.yml b/.github/actions/build-images/server/action.yml index 46fa35765..cb032e9ef 100644 --- a/.github/actions/build-images/server/action.yml +++ b/.github/actions/build-images/server/action.yml @@ -9,11 +9,6 @@ runs: if [[ "$ARCH" == "x64" ]]; then echo "ARCH=amd64" >> $GITHUB_ENV fi - - name: install yq - uses: ./.github/actions/install-yq - with: - arch: ${{ env.ARCH }} - use-sudo: true - name: Setup Environment Variables uses: ./.github/actions/setup-tag-env - id: env diff --git a/.github/actions/install-yq/action.yml b/.github/actions/install-yq/action.yml deleted file mode 100644 index 62dd2c472..000000000 --- a/.github/actions/install-yq/action.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: "Install yq" -description: "Install yq from source" -inputs: - version: - description: "yq version" - default: v4.45.1 - arch: - description: "host arch" - required: true - use-sudo: - description: "use sudo to move the yq binary" - default: false -runs: - using: "composite" - steps: - - name: install yq - shell: bash - run: | - curl -fsL https://github.com/mikefarah/yq/releases/download/${{ inputs.version }}/yq_linux_${{ inputs.arch }}.tar.gz | tar xz - ${{ inputs.use-sudo == 'true' && 'sudo' || '' }} mv yq_linux_${{ inputs.arch }} /usr/bin/yq - diff --git a/.github/actions/rancher-chart/build/action.yml b/.github/actions/rancher-chart/build/action.yml index ef0cdcb2d..02aad1499 100644 --- a/.github/actions/rancher-chart/build/action.yml +++ b/.github/actions/rancher-chart/build/action.yml @@ -9,10 +9,6 @@ runs: run: zypper install -y jq awk aws-cli - name: Setup Tag Env Variables uses: ./.github/actions/setup-tag-env - - name: install yq - uses: ./.github/actions/install-yq - with: - arch: ${{ env.ARCH }} - id: env name: Setup Dependencies Env Variables uses: ./.github/actions/setup-build-env diff --git a/dev-scripts/quick b/dev-scripts/quick index 6afdd63c8..0ff6a8d67 100755 --- a/dev-scripts/quick +++ b/dev-scripts/quick @@ -7,17 +7,17 @@ set -x # variables COMMIT=$(git rev-parse --short HEAD) -TAG="${TAG:-$(yq '.env.TAG | sub("-.*", "")' < .github/workflows/pull-request.yml)-${COMMIT}}-head" +TAG="${TAG:-$(grep -m1 ' TAG:' .github/workflows/pull-request.yml | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' -e "s/\${{ github.sha }}/$COMMIT/g" | cut -d' ' -f)-${COMMIT}}-head" OS="${OS:-linux}" ARCH="${ARCH:-amd64}" REPO="${REPO:-rancher}" CATTLE_K3S_VERSION=$(grep -m1 'ENV CATTLE_K3S_VERSION=' package/Dockerfile | cut -d '=' -f2) CATTLE_KDM_BRANCH=$(grep -m1 'ARG CATTLE_KDM_BRANCH=' package/Dockerfile | cut -d '=' -f2) -CATTLE_RANCHER_WEBHOOK_VERSION=$(yq '.webhookVersion' < build.yaml) -CATTLE_REMOTEDIALER_PROXY_VERSION=$(yq '.remoteDialerProxyVersion' < build.yaml) -CATTLE_CSP_ADAPTER_MIN_VERSION=$(yq '.cspAdapterMinVersion' < build.yaml) -CATTLE_RANCHER_PROVISIONING_CAPI_VERSION=$(yq '.provisioningCAPIVersion' < build.yaml) -CATTLE_FLEET_VERSION=$(yq '.fleetVersion' < build.yaml) +CATTLE_RANCHER_WEBHOOK_VERSION=$(grep -m1 'webhookVersion' build.yaml | cut -d ' ' -f2) +CATTLE_REMOTEDIALER_PROXY_VERSION=$(grep -m1 'remoteDialerProxyVersion' build.yaml | cut -d ' ' -f2) +CATTLE_CSP_ADAPTER_MIN_VERSION=$(grep -m1 'cspAdapterMinVersion' build.yaml | cut -d ' ' -f2) +CATTLE_RANCHER_PROVISIONING_CAPI_VERSION=$(grep -m1 'provisioningCAPIVersion' build.yaml | cut -d ' ' -f2) +CATTLE_FLEET_VERSION=$(grep -m1 'fleetVersion' build.yaml | cut -d ' ' -f2) # download airgap images and export it to a tarball curl -Lf https://github.com/rancher/k3s/releases/download/"${CATTLE_K3S_VERSION}"/k3s-images.txt -o ./k3s-images.txt diff --git a/docs/build.md b/docs/build.md index 155885998..fe5a441a0 100644 --- a/docs/build.md +++ b/docs/build.md @@ -29,8 +29,7 @@ webhookVersion: 2.0.6+up0.3.6-rc1 Then update the [export-config](../scripts/export-config) script. ``` -CATTLE_RANCHER_WEBHOOK_VERSION=$(yq -e '.webhookVersion' "$file") -export CATTLE_RANCHER_WEBHOOK_VERSION +export CATTLE_RANCHER_WEBHOOK_VERSION=$(grep -m1 'webhookVersion' < "$file" | cut -d ' ' -f2) ``` Run `go generate` from the root of the repo. diff --git a/scripts/export-config b/scripts/export-config index 80d5b916d..1b3f6f772 100755 --- a/scripts/export-config +++ b/scripts/export-config @@ -8,16 +8,9 @@ fi file="$(git rev-parse --show-toplevel)/build.yaml" -CATTLE_RANCHER_WEBHOOK_VERSION=$(yq -e '.webhookVersion' "$file") -CATTLE_REMOTEDIALER_PROXY_VERSION=$(yq -e '.remoteDialerProxyVersion' "$file") -CATTLE_RANCHER_PROVISIONING_CAPI_VERSION=$(yq -e '.provisioningCAPIVersion' "$file") -CATTLE_CSP_ADAPTER_MIN_VERSION=$(yq -e '.cspAdapterMinVersion' "$file") -CATTLE_DEFAULT_SHELL_VERSION=$(yq -e '.defaultShellVersion' "$file") -CATTLE_FLEET_VERSION=$(yq -e '.fleetVersion' "$file") - -export CATTLE_RANCHER_WEBHOOK_VERSION -export CATTLE_REMOTEDIALER_PROXY_VERSION -export CATTLE_RANCHER_PROVISIONING_CAPI_VERSION -export CATTLE_CSP_ADAPTER_MIN_VERSION -export CATTLE_DEFAULT_SHELL_VERSION -export CATTLE_FLEET_VERSION +export CATTLE_RANCHER_WEBHOOK_VERSION=$(grep -m1 'webhookVersion' "$file" | cut -d ' ' -f2) +export CATTLE_REMOTEDIALER_PROXY_VERSION=$(grep -m1 'remoteDialerProxyVersion' "$file" | cut -d ' ' -f2) +export CATTLE_RANCHER_PROVISIONING_CAPI_VERSION=$(grep -m1 'provisioningCAPIVersion' "$file" | cut -d ' ' -f2) +export CATTLE_CSP_ADAPTER_MIN_VERSION=$(grep -m1 'cspAdapterMinVersion' "$file" | cut -d ' ' -f2) +export CATTLE_DEFAULT_SHELL_VERSION=$(grep -m1 'defaultShellVersion' "$file" | cut -d ' ' -f2) +export CATTLE_FLEET_VERSION=$(grep -m1 'fleetVersion' "$file" | cut -d ' ' -f2) diff --git a/scripts/provisioning-tests b/scripts/provisioning-tests index e09ef4306..e0842bbeb 100755 --- a/scripts/provisioning-tests +++ b/scripts/provisioning-tests @@ -82,11 +82,11 @@ eval "$(grep '^ENV CATTLE_SYSTEM_AGENT_DOWNLOAD_PREFIX' package/Dockerfile | awk eval "$(grep '^ENV CATTLE_SYSTEM_AGENT_VERSION' package/Dockerfile | awk '{print "export " $2}')" eval "$(grep '^ENV CATTLE_SYSTEM_AGENT_UPGRADE_IMAGE' package/Dockerfile | awk '{print "export " $2}')" -export CATTLE_RANCHER_WEBHOOK_VERSION=$(yq '.webhookVersion' < build.yaml) -export CATTLE_REMOTEDIALER_PROXY_VERSION=$(yq '.remoteDialerProxyVersion' < build.yaml) -export CATTLE_RANCHER_PROVISIONING_CAPI_VERSION=$(yq '.provisioningCAPIVersion' < build.yaml) -export CATTLE_CSP_ADAPTER_MIN_VERSION=$(yq '.cspAdapterMinVersion' < build.yaml) -export CATTLE_FLEET_VERSION=$(yq '.fleetVersion' < build.yaml) +export CATTLE_RANCHER_WEBHOOK_VERSION=$(grep -m1 'webhookVersion' build.yaml | cut -d ' ' -f2) +export CATTLE_REMOTEDIALER_PROXY_VERSION=$(grep -m1 'remoteDialerProxyVersion' build.yaml | cut -d ' ' -f2) +export CATTLE_RANCHER_PROVISIONING_CAPI_VERSION=$(grep -m1 'provisioningCAPIVersion' build.yaml | cut -d ' ' -f2) +export CATTLE_CSP_ADAPTER_MIN_VERSION=$(grep -m1 'cspAdapterMinVersion' build.yaml | cut -d ' ' -f2) +export CATTLE_FLEET_VERSION=$(grep -m1 'fleetVersion' build.yaml | cut -d ' ' -f2) if [ -z "${SOME_K8S_VERSION}" ]; then # Only set SOME_K8S_VERSION if it is empty -- for KDM provisioning tests, this value should already be populated diff --git a/scripts/test b/scripts/test index d42ed8350..c337df487 100755 --- a/scripts/test +++ b/scripts/test @@ -55,7 +55,7 @@ eval "$(grep '^ENV CATTLE_WINS_AGENT' package/Dockerfile | awk '{print "export " eval "$(grep '^ENV CATTLE_CSI_PROXY_AGENT' package/Dockerfile | awk '{print "export " $2}')" eval "$(grep '^ENV CATTLE_KDM_BRANCH' package/Dockerfile | awk '{print "export " $2}')" -export CATTLE_RANCHER_PROVISIONING_CAPI_VERSION=$(yq '.provisioningCAPIVersion' < build.yaml) +export CATTLE_RANCHER_PROVISIONING_CAPI_VERSION=$(grep -m1 'provisioningCAPIVersion' build.yaml | cut -d ' ' -f2) if [ -z "${SOME_K8S_VERSION}" ]; then # Get the last release for $DIST, which is usually the latest version or an experimental version.