skip to Main Content

Description

Running this:

$ circleci build --branch master --repo-url https://bitbucket.org/cityhive/city-hive-standalone-widget --job e2e

Getting these errors

Cloning into '.'...
Username for 'https://bitbucket.org': fatal: could not read Username for 'https://bitbucket.org': Success

...


# (from Jira orb)
/bin/bash: CIRCLE_TOKEN: Please provide a CircleCI API token for this orb to work!

If I’m trying to pass token I get this:

$ circleci build --token d14c4********* --branch master --repo-url https://bitbucket.org/cityhive/city-hive-standalone-widget --job e2e

Fetching latest build environment...
Docker image digest: sha256:7a080ca333******
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
Error: unknown flag: --token
ERRO[0000] Exit with status 1 due to generic error       error="unknown flag: --token"

Location

https://circleci.com/docs/2.0/local-cli/#run-a-job-in-a-container-on-your-machine

Steps to Reproduce

Run job that checks out the code and have the JIRA orb locally locally

Additional Context

running macOS Monterey 12.3.1 (21E258), Silicon apple chip

Docker:

$ docker version
Client:
 Cloud integration: v1.0.20
 Version:           20.10.10
 API version:       1.41
 Go version:        go1.16.9
 Git commit:        b485636
 Built:             Mon Oct 25 07:43:15 2021
 OS/Arch:           darwin/arm64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.10
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.16.9
  Git commit:       e2f740d
  Built:            Mon Oct 25 07:41:10 2021
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          1.4.11
  GitCommit:        5b46e404f6b9f661a205e28d59c982d3634148f8
 runc:
  Version:          1.0.2
  GitCommit:        v1.0.2-0-g52b36a2
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Config.yml

version: 2.1
orbs:
  node: circleci/[email protected]
  jira: circleci/[email protected]
  ruby: circleci/[email protected]

commands:
  ch-checkout:
    steps:
      # Instead of the default `checkout` phase that doesn't support depth.
      - run:
          name: "Checkout Repository with --Depth 1"
          command: |
              SSH_CONFIG_DIR="/home/circleci/.ssh"
              mkdir -p "$SSH_CONFIG_DIR"
              chmod 0700 "$SSH_CONFIG_DIR"
              echo "bitbucket.org ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAubiN81eDcafrgMeLzaFPsw2kNvEcqTKl/VqLat/MaB33pZy0y3rJZtnqwR2qOOvbwKZYKiEO1O6VqNEBxKvJJelCq0dTXWT5pbO2gDXC6h6QDXCaHo6pOHGPUy+YBaGQRGuSusMEASYiWunYN0vCAI8QaXnWMXNMdFP3jHAJH0eDsoiGnLPBlBp4TNm6rYI74nMzgz3B9IikW4WVK+dc8KZJZWYjAuORU3jc1c/NPskD2ASinf8v3xnfXeukU0sJ5N6m5E8VLjObPEO+mN2t/FZTMZLiFqPWc/ALSqnMnnhwrNi2rbfg/rd/IpL8Le3pSBne8+seeFVBoGqzHM9yXw==" >> "$SSH_CONFIG_DIR/known_hosts"
              chmod 0600 "$SSH_CONFIG_DIR/known_hosts"
              cd '/home/circleci/myapp'
              git clone --depth 1 "$CIRCLE_REPOSITORY_URL" --branch "$CIRCLE_BRANCH" .
      - run: ls -la ~/myapp/
  
  ch-install-compass:
    steps:
      - run:
          name: Install ruby
          command: |
            sudo apt update
            sudo apt install ruby-dev -y
            ruby -v
      - run:
          name: Install compass
          command: sudo gem install compass

  ch-ls:
    steps:
      - run:
          name: ls
          command: ls

  ch-widget-npm:
    steps:
     - node/install-packages

  ch-widget-bower:
    steps:
      - run:
          name: Widget - Install Deps (bower)
          command: npx bower install

  ch-widget-build:
    steps:
      - run:
          name: Widget - Build
          command: npx grunt build:prod

  ch-widget-test:
    steps:
      - run:
          name: Widget - Test
          command: |
              npx grunt build:dev
              # this only works by repeating it twice in the same step the test is invoked 🤷‍♀️
              Xvfb -s "-nolisten tcp -nolisten unix" -ac :99 -screen 0 1280x1024x16 &
              export DISPLAY=:99
              Xvfb -s "-nolisten tcp -nolisten unix" -ac :99 -screen 0 1280x1024x16 &
              export DISPLAY=:99
              npx karma start --browsers Chrome --single-run --env=ci --reporters dots
              npx karma start --browsers Chrome --single-run --loader-tests --env=ci --reporters dots

  ch-elements-npm:
    steps:
      - node/install-packages:
          app-dir: city-hive-custom-elements

  ch-elements-build:
    steps:
      - run:
          name: Custom Elements - Build
          command: cd city-hive-custom-elements/; npm run build

  ch-elements-test:
    steps:
      - run:
          name: Custom Elements - Tests
          command: |
              # this only works by repeating it twice in the same step the test is invoked 🤷‍♀️
              Xvfb -s "-nolisten tcp -nolisten unix" -ac :99 -screen 0 1280x1024x16 &
              export DISPLAY=:99
              Xvfb -s "-nolisten tcp -nolisten unix" -ac :99 -screen 0 1280x1024x16 &
              export DISPLAY=:99
              cd city-hive-custom-elements/; npm run test -- --watch=false
  
  ch-install-chrome:
    steps:
      - run:
          name: Install chrome deps
          command: sudo apt update && sudo apt install xdg-utils fonts-liberation libasound2 libatk-bridge2.0-0 libatk1.0-0 libatspi2.0-0 libcairo2 libcups2 libgbm1 libgtk-3-0 libnspr4 libnss3 libpango-1.0-0 libxdamage1 libxkbcommon0
      - run:
          name: Install chrome
          command: |
              wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
              sudo dpkg -i google-chrome-stable_current_amd64.deb

  ch-karma-deps:
    steps:
      - run:
          name: Karma - Deps
          command: |
              sudo apt-get install -y xvfb
  
  ch-spin-widget-dev:
    steps:
      - run:
          name: Spin Widget
          command: npx grunt serve:dev
          background: true

  ch-spin-elements-dev:
    steps:
      - run:
          name: Spin Custom Elements
          command: cd city-hive-custom-elements/; npm run serve
          background: true    

  ch-cypress-deps:
    steps:
      - run:
          name: Install Cypress deps
          command: sudo apt update && sudo apt install libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb
  
  ch-wait-for-servers:
    steps:
      - run:
          name: Wait for local servers
          command: |
            npx wait-on http://localhost:4200
            npx wait-on http://localhost:9003
  
  ch-cypress:
    steps:
      - run:
          name: Run Cypress tests
          no_output_timeout: 10m
          command: |
            mkdir ~/test_reports
            ./bin/ci_e2e
      - store_test_results:
          path: ~/test_reports
      - store_artifacts:
          path: ~/test_reports

jobs:
  build-widget:
    working_directory: ~/myapp
    docker:
      - image: cimg/node:16.13.1
    environment:
      # Enable colors in the output
      TERM: xterm
    steps:
      - ch-checkout
      - ch-install-compass
      - ch-widget-npm
      - ch-widget-bower
      - ch-widget-build

  test-widget:
    working_directory: ~/myapp
    docker:
      - image: cimg/node:16.13.1-browsers
    environment:
      # Enable colors in the output
      TERM: xterm
    steps:
      - ch-checkout
      - ch-install-compass
      - ch-widget-npm
      - ch-widget-bower
      - ch-install-chrome
      - ch-karma-deps
      - ch-widget-test

  build-elements:
    working_directory: ~/myapp
    docker:
      - image: cimg/node:16.13.1
    environment:
      # Enable colors in the output
      TERM: xterm
    steps:
      - ch-checkout
      - ch-elements-npm
      - ch-elements-build

  test-elements:
    working_directory: ~/myapp
    docker:
      - image: cimg/node:16.13.1-browsers
    environment:
      # Enable colors in the output
      TERM: xterm
    steps:
      - ch-checkout
      - ch-elements-npm
      - ch-elements-build
      - ch-install-chrome
      - ch-karma-deps
      - ch-elements-test

  e2e:
    working_directory: ~/myapp
    docker:
      - image: cimg/node:16.13.1-browsers
    resource_class: large
    environment:
      # Enable colors in the output
      TERM: xterm
    parallelism: 31
    steps:
      - ch-checkout
      - ch-install-compass
      - ch-widget-npm
      - ch-widget-bower
      - ch-elements-npm
      - ch-spin-widget-dev
      - ch-spin-elements-dev
      - ch-install-chrome
      - ch-cypress-deps
      - ch-wait-for-servers
      - ch-cypress

workflows:
  build-and-test:
    jobs:
      - build-widget:
          post-steps:
            - jira/notify
      
      - test-widget:
          post-steps:
            - jira/notify
      
      - build-elements:
          post-steps:
            - jira/notify
      
      - test-elements:
          post-steps:
            - jira/notify
      
      - e2e:
          post-steps:
            - jira/notify

2

Answers


  1. @ goldylucks,

    The --token flag is a global flag for the CLI setup:

    –token string your token for using CircleCI, also CIRCLECI_CLI_TOKEN

    For the Jira orb, the CircleCI API token is needed as an environment variable.

    Looking at the output of circleci build -help, I see:

    -e, --env -e VAR=VAL        Set environment variables, e.g. -e VAR=VAL
    

    This is the flag you’d need to use, as outlined in the CircleCI CLI documentation.

    Login or Signup to reply.
  2. Try using CIRCLECI_CLI_TOKEN environment variable instead:

    CIRCLECI_CLI_TOKEN=d14c4*********  
    circleci build 
    --branch master 
    --repo-url https://bitbucket.org/cityhive/city-hive-standalone-widget 
    --job e2e
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search