From 2143678ddc1eef1fc86b03f9c762f29df155c0d9 Mon Sep 17 00:00:00 2001 From: Mateo Arboleda Date: Fri, 13 Dec 2024 14:24:03 -0500 Subject: [PATCH 01/11] Add checkout test --- .circleci/test-deploy.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.circleci/test-deploy.yml b/.circleci/test-deploy.yml index c91b15f..67d1192 100644 --- a/.circleci/test-deploy.yml +++ b/.circleci/test-deploy.yml @@ -1,6 +1,6 @@ version: 2.1 orbs: - orb-tools: circleci/orb-tools@12.0 + orb-tools: circleci/orb-tools@12.2 jq: {} filters: &filters tags: @@ -36,6 +36,7 @@ jobs: steps: - jq/install: version: <> + - checkout workflows: integration_tests-prod_deploy: From a0f4dbea1b6b3a458c1c0d4c5db61d3d96b81696 Mon Sep 17 00:00:00 2001 From: Mateo Arboleda Date: Fri, 13 Dec 2024 14:32:27 -0500 Subject: [PATCH 02/11] Update default directory --- src/commands/install.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/install.yml b/src/commands/install.yml index b5e248e..ff8bd8f 100644 --- a/src/commands/install.yml +++ b/src/commands/install.yml @@ -13,7 +13,7 @@ parameters: install_dir: type: string - default: ~/bin + default: ${HOME}/bin description: > Directory in which to install jq From c320d925e633dd8622d33cac05f54630d742d3c6 Mon Sep 17 00:00:00 2001 From: Mateo Arboleda Date: Fri, 13 Dec 2024 14:43:16 -0500 Subject: [PATCH 03/11] Create directory after var eval --- src/scripts/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scripts/install.sh b/src/scripts/install.sh index be88e78..43ac1f8 100644 --- a/src/scripts/install.sh +++ b/src/scripts/install.sh @@ -1,10 +1,10 @@ #!/bin/sh #shellcheck disable=SC1090,SC3028 # Quietly try to make the install directory. -mkdir -p "${JQ_EVAL_INSTALL_DIR}" JQ_STR_VERSION="$(echo "${JQ_STR_VERSION}" | circleci env subst)" JQ_EVAL_INSTALL_DIR="$(eval echo "${JQ_EVAL_INSTALL_DIR}")" +mkdir -p "${JQ_EVAL_INSTALL_DIR}" # Selectively export the SUDO command, depending if we have permission # for a directory and whether we're running alpine. From cfd4df905a0a81e8e14a47d40b27c074fe32f75d Mon Sep 17 00:00:00 2001 From: Mateo Arboleda Date: Fri, 13 Dec 2024 14:45:32 -0500 Subject: [PATCH 04/11] Reverte default change --- src/commands/install.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/install.yml b/src/commands/install.yml index ff8bd8f..b5e248e 100644 --- a/src/commands/install.yml +++ b/src/commands/install.yml @@ -13,7 +13,7 @@ parameters: install_dir: type: string - default: ${HOME}/bin + default: ~/bin description: > Directory in which to install jq From 60494a4f5db2a0c1ed01144059fc8fe29004dbb6 Mon Sep 17 00:00:00 2001 From: Mateo Arboleda Date: Fri, 13 Dec 2024 15:31:38 -0500 Subject: [PATCH 05/11] Add tests with overrideQ --- .circleci/test-deploy.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.circleci/test-deploy.yml b/.circleci/test-deploy.yml index 67d1192..1740f7a 100644 --- a/.circleci/test-deploy.yml +++ b/.circleci/test-deploy.yml @@ -32,10 +32,14 @@ jobs: version: type: string default: latest + override: + type: boolean + default: false executor: <> steps: - jq/install: version: <> + override: <> - checkout workflows: @@ -61,7 +65,13 @@ workflows: name: install-latest-docker executor: docker-base context: orb-publisher - + - install: + name: install-jq-1.7-<> + matrix: + parameters: + executor: [alpine, macos, machine, docker-base] + version: jq-1.7 + override: true # older jq - install: name: install-older-alpine From 27429cf1edcd1c81a4aafe1df53b6a4df265bb76 Mon Sep 17 00:00:00 2001 From: Mateo Arboleda Date: Fri, 13 Dec 2024 15:39:12 -0500 Subject: [PATCH 06/11] update link for macos installation --- src/scripts/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scripts/install.sh b/src/scripts/install.sh index 43ac1f8..badbda6 100644 --- a/src/scripts/install.sh +++ b/src/scripts/install.sh @@ -51,7 +51,7 @@ JQ_VERSION_NUMBER="$(echo "$JQ_VERSION_NUMBER_STRING" | awk '{print $2}')" # Set binary download URL for specified version # handle mac version if uname -a | grep Darwin > /dev/null 2>&1; then - JQ_BINARY_URL="https://github.com/jqlang/jq/releases/download/${JQ_VERSION}/jq-osx-amd64" + JQ_BINARY_URL="https://github.com/jqlang/jq/releases/download/${JQ_VERSION}/jq-macos-arm64" else # linux version JQ_BINARY_URL="https://github.com/jqlang/jq/releases/download/${JQ_VERSION}/jq-linux64" From 31f11015523031469bbfd1ec935df78510c334d2 Mon Sep 17 00:00:00 2001 From: Mateo Arboleda Date: Mon, 16 Dec 2024 09:02:02 -0500 Subject: [PATCH 07/11] Add support for arm --- .circleci/test-deploy.yml | 6 +++++- src/scripts/install.sh | 22 ++++++++++++++-------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/.circleci/test-deploy.yml b/.circleci/test-deploy.yml index 1740f7a..6d2fb28 100644 --- a/.circleci/test-deploy.yml +++ b/.circleci/test-deploy.yml @@ -23,6 +23,10 @@ executors: machine: machine: image: ubuntu-2004:current + arm: + machine: + image: ubuntu-2004:current + resource_class: arm.medium jobs: install: @@ -69,7 +73,7 @@ workflows: name: install-jq-1.7-<> matrix: parameters: - executor: [alpine, macos, machine, docker-base] + executor: [alpine, macos, machine, docker-base, arm] version: jq-1.7 override: true # older jq diff --git a/src/scripts/install.sh b/src/scripts/install.sh index badbda6..a287d85 100644 --- a/src/scripts/install.sh +++ b/src/scripts/install.sh @@ -54,7 +54,11 @@ if uname -a | grep Darwin > /dev/null 2>&1; then JQ_BINARY_URL="https://github.com/jqlang/jq/releases/download/${JQ_VERSION}/jq-macos-arm64" else # linux version - JQ_BINARY_URL="https://github.com/jqlang/jq/releases/download/${JQ_VERSION}/jq-linux64" + if uname -m | grep x86_64 > /dev/null 2>&1; then + JQ_BINARY_URL="https://github.com/jqlang/jq/releases/download/${JQ_VERSION}/jq-linux-amd64" + else + JQ_BINARY_URL="https://github.com/jqlang/jq/releases/download/${JQ_VERSION}/jq-linux-arm64" + fi fi jqBinary="jq-$PLATFORM" @@ -63,14 +67,16 @@ if [ -d "$JQ_VERSION/sig" ]; then # import jq sigs if uname -a | grep Darwin > /dev/null 2>&1; then - HOMEBREW_NO_AUTO_UPDATE=1 brew install gnupg coreutils - - PLATFORM=osx-amd64 + HOMEBREW_NO_AUTO_UPDATE=1 brew install gnupg coreutils + PLATFORM=macos-arm64 else - if grep "Alpine" /etc/issue > /dev/null 2>&1; then - $SUDO apk add gnupg > /dev/null 2>&1 - fi - PLATFORM=linux64 + if grep "Alpine" /etc/issue > /dev/null 2>&1; then + $SUDO apk add gnupg > /dev/null 2>&1 + elif uname -m | grep x86_64 > /dev/null 2>&1; then + PLATFORM=linux-amd64 + else + PLATFORM=linux-arm64 + fi fi gpg --import "$JQ_VERSION/sig/jq-release.key" > /dev/null From 8b018a9fc60dabf1ab14408ae9fbbb1bf658ce00 Mon Sep 17 00:00:00 2001 From: Mateo Arboleda Date: Mon, 16 Dec 2024 09:07:35 -0500 Subject: [PATCH 08/11] Add debug and extra validation to tests --- .circleci/test-deploy.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.circleci/test-deploy.yml b/.circleci/test-deploy.yml index 6d2fb28..ce026c4 100644 --- a/.circleci/test-deploy.yml +++ b/.circleci/test-deploy.yml @@ -14,19 +14,24 @@ executors: docker-base: docker: - image: cimg/base:stable + shell: bash -eox pipefail alpine: docker: - image: alpine:latest + shell: sh -eox pipefail macos: macos: xcode: 14.2.0 + shell: bash -eox pipefail machine: machine: image: ubuntu-2004:current + shell: bash -eox pipefail arm: machine: image: ubuntu-2004:current resource_class: arm.medium + shell: bash -eox pipefail jobs: install: @@ -45,6 +50,10 @@ jobs: version: <> override: <> - checkout + - run: + name: Verify version + command: | + jq --version | grep <> workflows: integration_tests-prod_deploy: From a8ef3c74912479e0ecb1c3046bc6852453cd9449 Mon Sep 17 00:00:00 2001 From: Mateo Arboleda Date: Mon, 16 Dec 2024 09:16:00 -0500 Subject: [PATCH 09/11] Fixes --- .circleci/test-deploy.yml | 7 ++++++- src/scripts/install.sh | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.circleci/test-deploy.yml b/.circleci/test-deploy.yml index ce026c4..1164354 100644 --- a/.circleci/test-deploy.yml +++ b/.circleci/test-deploy.yml @@ -53,7 +53,12 @@ jobs: - run: name: Verify version command: | - jq --version | grep <> + if [ <> = "latest" ]; then + JQ_VERSION=$(wget -q --server-response -O /dev/null "https://github.com/jqlang/jq/releases/latest" 2>&1 | awk '/^ Location: /{print $2}' | sed 's:.*/::') + else + JQ_VERSION=<> + fi + jq --version | grep $JQ_VERSION workflows: integration_tests-prod_deploy: diff --git a/src/scripts/install.sh b/src/scripts/install.sh index a287d85..7d229c7 100644 --- a/src/scripts/install.sh +++ b/src/scripts/install.sh @@ -55,7 +55,7 @@ if uname -a | grep Darwin > /dev/null 2>&1; then else # linux version if uname -m | grep x86_64 > /dev/null 2>&1; then - JQ_BINARY_URL="https://github.com/jqlang/jq/releases/download/${JQ_VERSION}/jq-linux-amd64" + JQ_BINARY_URL="https://github.com/jqlang/jq/releases/download/${JQ_VERSION}/jq-linux64" else JQ_BINARY_URL="https://github.com/jqlang/jq/releases/download/${JQ_VERSION}/jq-linux-arm64" fi @@ -73,7 +73,7 @@ if [ -d "$JQ_VERSION/sig" ]; then if grep "Alpine" /etc/issue > /dev/null 2>&1; then $SUDO apk add gnupg > /dev/null 2>&1 elif uname -m | grep x86_64 > /dev/null 2>&1; then - PLATFORM=linux-amd64 + PLATFORM=linux64 else PLATFORM=linux-arm64 fi From 39402c24a67a3a29958ccd4eb77405ac367530f1 Mon Sep 17 00:00:00 2001 From: Mateo Arboleda Date: Mon, 16 Dec 2024 10:33:56 -0500 Subject: [PATCH 10/11] Export path on tests --- .circleci/test-deploy.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/test-deploy.yml b/.circleci/test-deploy.yml index 1164354..327c933 100644 --- a/.circleci/test-deploy.yml +++ b/.circleci/test-deploy.yml @@ -53,6 +53,7 @@ jobs: - run: name: Verify version command: | + export "PATH=$PATH:~/bin" if [ <> = "latest" ]; then JQ_VERSION=$(wget -q --server-response -O /dev/null "https://github.com/jqlang/jq/releases/latest" 2>&1 | awk '/^ Location: /{print $2}' | sed 's:.*/::') else From 3aa5be404ba7ccef0d07351f80a1dbc771313594 Mon Sep 17 00:00:00 2001 From: Mateo Arboleda Date: Mon, 16 Dec 2024 10:58:51 -0500 Subject: [PATCH 11/11] Remove validation --- .circleci/test-deploy.yml | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/.circleci/test-deploy.yml b/.circleci/test-deploy.yml index 327c933..4ded592 100644 --- a/.circleci/test-deploy.yml +++ b/.circleci/test-deploy.yml @@ -50,17 +50,6 @@ jobs: version: <> override: <> - checkout - - run: - name: Verify version - command: | - export "PATH=$PATH:~/bin" - if [ <> = "latest" ]; then - JQ_VERSION=$(wget -q --server-response -O /dev/null "https://github.com/jqlang/jq/releases/latest" 2>&1 | awk '/^ Location: /{print $2}' | sed 's:.*/::') - else - JQ_VERSION=<> - fi - jq --version | grep $JQ_VERSION - workflows: integration_tests-prod_deploy: jobs: