CircleCI-Public / jira-connect-orb

Display the status of CircleCI workflows and deployments in Jira!
https://circleci.com/orbs/registry/orb/circleci/jira
MIT License
25 stars 27 forks source link

circleci/jira@1.3.0 is not working correctly with Jira service management #57

Closed ishaker93 closed 3 years ago

ishaker93 commented 3 years ago

Orb version: 1.3.0

What happened

install JQ fails:

Here is the output of that step:

  #!/bin/bash -eo pipefail
# Quietly try to make the install directory.
mkdir -p ~/bin | true

# Selectively export the SUDO command, depending if we have permission
# for a directory and whether we're running alpine.
if [[ $EUID == 0 ]]; then export SUDO=""; else # Check if we're root
  if cat /etc/issue | grep Alpine > /dev/null 2>&1 || ! [[ -w "~/bin" ]]; then
    export SUDO="sudo";
  fi
fi

# If our first mkdir didn't succeed, we needed to run as sudo.
if [ ! -w ~/bin ]; then
  $SUDO mkdir -p ~/bin
fi

echo 'export PATH=$PATH:~/bin' >> $BASH_ENV
source $BASH_ENV

# check if jq needs to be installed
if command -v jq >> /dev/null 2>&1; then

    echo "jq is already installed..."

  if [[ true == true ]]; then
    echo "removing it."
    $SUDO rm -f $(command -v jq)
  else
    echo "ignoring install request."
    exit 0
  fi
fi

# Set jq version
if [[ latest == "latest" ]]; then
  JQ_VERSION=$(curl -Ls -o /dev/null -w %{url_effective} "https://github.com/stedolan/jq/releases/latest" | sed 's:.*/::')
  echo "Latest version of jq is $JQ_VERSION"
else
  JQ_VERSION=latest
fi

# extract version number
JQ_VERSION_NUMBER_STRING=$(echo $JQ_VERSION | sed -E 's/-/ /')
arrJQ_VERSION_NUMBER=($JQ_VERSION_NUMBER_STRING)
JQ_VERSION_NUMBER="${arrJQ_VERSION_NUMBER[1]}"

# 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/stedolan/jq/releases/download/${JQ_VERSION}/jq-osx-amd64"
else
  # linux version
  JQ_BINARY_URL="https://github.com/stedolan/jq/releases/download/${JQ_VERSION}/jq-linux64"
fi

jqBinary="jq-$PLATFORM"

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
  else
    if cat /etc/issue | grep Alpine > /dev/null 2>&1; then
      $SUDO apk add gnupg > /dev/null 2>&1
    fi
    PLATFORM=linux64
  fi

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

  curl --output "$JQ_VERSION/sig/v$JQ_VERSION_NUMBER/jq-$PLATFORM" \
      --silent --show-error --location --fail --retry 3 \
      "$JQ_BINARY_URL"

  # verify sha256sum, sig, install

  gpg --verify "$JQ_VERSION/sig/v$JQ_VERSION_NUMBER/jq-$PLATFORM.asc"

  pushd "$JQ_VERSION/sig/v$JQ_VERSION_NUMBER" && grep "jq-$PLATFORM" "sha256sum.txt" | \
  sha256sum -c -
  popd
  jqBinary="$JQ_VERSION/sig/v$JQ_VERSION_NUMBER/jq-$PLATFORM"

else
  curl --output "$jqBinary" \
    --silent --show-error --location --fail --retry 3 \
    "$JQ_BINARY_URL"
fi

$SUDO mv "$jqBinary" ~/bin/jq
$SUDO chmod +x ~/bin/jq

# cleanup
[[ -d "./$JQ_VERSION" ]] && rm -rf "./$JQ_VERSION"

# verify version
echo "jq has been installed to $(which jq)"
echo "jq version:"
echo "$(jq --version)"
/tmp/.bash_env-5fe6730342b32261338060d6-0-build: line 2: export: `********************************************': not a valid identifier
/tmp/.bash_env-5fe6730342b32261338060d6-0-build: line 2: export: `********************************************': not a valid identifier

Exited with code exit status 1
CircleCI received exit code 1

-->

The workflow failed because of the JQ installation, The JIRA connection functions on my Jira service management as a change request but without defining the failure or the success of the workflow.

Expected behavior

The success of the workflow but it gives fails because the JQ install fails. Showing the success or the failure of the workflow at the Jira service management change request.

gmemstr commented 3 years ago

I'm not sure this is related to either the Jira or jq orbs. I'm guessing that the environment variable values have been set to something that bash can't reason with, similar to https://stackoverflow.com/questions/18042369/bash-export-not-a-valid-identifier.

xqliu commented 3 years ago

I also meet this issue, the image I use is node:current-alpine during build.

ishaker93 commented 3 years ago

I also meet this issue, the image I use is node:current-alpine during build.

I'm not sure this is related to either the Jira or jq orbs. I'm guessing that the environment variable values have been set to something that bash can't reason with, similar to https://stackoverflow.com/questions/18042369/bash-export-not-a-valid-identifier.

@gmemstr I will check that Thanks.

ishaker93 commented 3 years ago

I also meet this issue, the image I use is node:current-alpine during the build.

did you manage to solve it?

dsayling commented 3 years ago

@ishaker93 - If you're using an alpine image, you may need to install bash first

KyleTryon commented 3 years ago

Hello all, If you are al alpine user please see this comment: https://github.com/CircleCI-Public/jira-connect-orb/issues/64#issuecomment-881542494