Skip to content

Commit

Permalink
Merge pull request #40 from CircleCI-Public/issue-39
Browse files Browse the repository at this point in the history
Fix issue with non desired folder is created
  • Loading branch information
marboledacci authored Dec 16, 2024
2 parents 8cd7d24 + 3aa5be4 commit 8b4c0c1
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 13 deletions.
25 changes: 22 additions & 3 deletions .circleci/test-deploy.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -14,15 +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:
Expand All @@ -32,11 +41,15 @@ jobs:
version:
type: string
default: latest
override:
type: boolean
default: false
executor: <<parameters.executor>>
steps:
- jq/install:
version: <<parameters.version>>

override: <<parameters.override>>
- checkout
workflows:
integration_tests-prod_deploy:
jobs:
Expand All @@ -60,7 +73,13 @@ workflows:
name: install-latest-docker
executor: docker-base
context: orb-publisher

- install:
name: install-jq-1.7-<<matrix.executor>>
matrix:
parameters:
executor: [alpine, macos, machine, docker-base, arm]
version: jq-1.7
override: true
# older jq
- install:
name: install-older-alpine
Expand Down
26 changes: 16 additions & 10 deletions src/scripts/install.sh
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -51,10 +51,14 @@ 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"
if uname -m | grep x86_64 > /dev/null 2>&1; then
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
fi

jqBinary="jq-$PLATFORM"
Expand All @@ -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=linux64
else
PLATFORM=linux-arm64
fi
fi

gpg --import "$JQ_VERSION/sig/jq-release.key" > /dev/null
Expand Down

0 comments on commit 8b4c0c1

Please sign in to comment.