iynere / compare-url

CircleCI 2.1 pipelines disable the CIRCLE_COMPARE_URL environment variable, useful when working with monorepo projects. This orb manually recreates (and improves!) it.
https://circleci.com/orbs/registry/orb/iynere/compare-url
32 stars 20 forks source link

reconstruct fails #30

Open tessalt opened 5 years ago

tessalt commented 5 years ago

Orb version

1.1.0

What happened

attempting to include -compare-url/reconstruct as a step, fails with Exited with code 1

checking if cicd is a new branch...
----------------------------------------------------------------------------------------------------
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

100    37  100    37    0     0   1241      0 --:--:-- --:--:-- --:--:--  1275
----------------------------------------------------------------------------------------------------
yes, cicd is new and f673e3c10bdcf1ebcc6b36aea8515e35f7697df3 is its only commit
finding most recent ancestor commit from any other branch...
----------------------------------------------------------------------------------------------------
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

100    37  100    37    0     0    465      0 --:--:-- --:--:-- --:--:--   468
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

100    37  100    37    0     0   1696      0 --:--:-- --:--:-- --:--:--  1761
Exited with code 1

Expected behavior

Reconstruct command should not fail

okarlsson commented 5 years ago

@tessalt Have you included your CIRCLE_TOKEN in your environment variables?

aecorredor commented 5 years ago

Same here, fails for me with same exit code error. I did include the CIRCLE_TOKEN in the env variables. I included them in my project's environment variables section, I even get this job in the workflow:

#!/bin/bash -eo pipefail
if [[ -z "${CIRCLE_TOKEN}" ]]; then
  echo "ERROR: Missing environment variable CIRCLE_TOKEN" >&2
  if [[ -n "You have not stored a CircleCI API token. If this is a private repository, the next step will fail.
" ]]; then
    echo "You have not stored a CircleCI API token. If this is a private repository, the next step will fail.
" >&2
  fi

else
  echo "Yes, CIRCLE_TOKEN is defined!"
fi
Yes, CIRCLE_TOKEN is defined!
aecorredor commented 5 years ago

Turns out I was using a project token instead of a personal one. I don't recall reading anything about this in the docs, maybe I missed it. If not, it would be good to document it :) thanks for the orb

sapanju commented 5 years ago

I had this issue and fixed it by making sure my project API token matched the CIRCLE_TOKEN defined in the env variables of my project. So, I was able to use a project token, just had to make sure it matched the env var.

rmuthupandian commented 5 years ago

@sapanju I am also facing the same issue. Could you help me understand how you solved the issue. Where does Project API token set ? How to set Project token to CIRCLE_TOKEN ?

sapanju commented 5 years ago

@sapanju I am also facing the same issue. Could you help me understand how you solved the issue. Where does Project API token set ? How to set Project token to CIRCLE_TOKEN ?

hi @rmuthupandian - the Project API token can be created by going to your project settings page > Permissions > API Permissions (see https://circleci.com/docs/2.0/managing-api-tokens/?gclid=EAIaIQobChMIg4rgrsvn5AIVhKDsCh0BVAeDEAAYASAAEgLCwPD_BwE#creating-a-project-api-token) Once you create a key, then you can go to your project settings > Environment Variables and set a variable for CIRCLE_TOKEN with the value equal to the API token you just set.