eddiewebb / circleci-queue

CircleCI orb to block/queue jobs to enforce max concurrency limits
MIT License
74 stars 75 forks source link

[3.1.2] Error when no commit message #124

Closed mustangJaro closed 6 months ago

mustangJaro commented 6 months ago

Orb version

3.1.2

What happened

When force-pushing commits to a branch, they don't contain commit messages. This causes an error where CircleCI is indicating that arguments are unexpected, even though they are configured for the orb.

image

This same commit worked successfully when a commit message was present.

image

Expected behavior

The absence of a commit message should not cause a failure. It should continue processing regardless of a message.

eddiewebb commented 6 months ago

That error is not from my orb, but CCI platform. Could you share your setup config?

On Wed, Mar 20, 2024, 12:26 AM AJ @.***> wrote:

Orb version

3.1.2 What happened

When force-pushing commits to a branch, they don't contain commit messages. This causes an error where CircleCI is indicating that arguments are unexpected, even though they are configured for the orb. image.png (view on web) https://github.com/eddiewebb/circleci-queue/assets/16509697/94a256a9-a509-4658-ab8e-265199e55486

This same commit worked successfully when a commit message was present. image.png (view on web) https://github.com/eddiewebb/circleci-queue/assets/16509697/85fa1501-2b78-49c0-96d9-5370c3321be0 Expected behavior

The absence of a commit message should not cause a failure. It should continue processing regardless of a message.

— Reply to this email directly, view it on GitHub https://github.com/eddiewebb/circleci-queue/issues/124, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABIEWSWAIERVOXG45GM6RIDYZEFW5AVCNFSM6AAAAABE6YJG22VHI2DSMVQWIX3LMV43ASLTON2WKOZSGE4TMNRUGEYTMMQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

mustangJaro commented 6 months ago

@eddiewebb - great point!

I was not thinking as clearly late last night as I was working on something else, however I'd love your help if you can identify the source of the issue. It seems like this was exacerbated by upgrading from Node 18.17.1 to Node 18.18.2

config.yml

version: 2.1

setup: true

orbs:
  path-filtering: circleci/path-filtering@1.0.0

workflows:
  setup:
    jobs:
      - path-filtering/filter:
          name: check-updated-files
          base-revision: master
          mapping: |
            status-shop/.* run-status-shop-workflow true .circleci/status-shop.yml
            ^(?!status-shop).* run-statusphere-workflow true .circleci/statusphere.yml

statusphere.yml


version: 2.1

orbs:
  sam: circleci/aws-sam-serverless@3.2.0
  aws-cli: circleci/aws-cli@3.1.1
  eb: circleci/aws-elastic-beanstalk@2.0.1
  queue: eddiewebb/queue@3.1.2
  jira: circleci/jira@2.0.1
  slack: circleci/slack@4.12.5

parameters:
  run-statusphere-workflow:
    type: boolean
    default: false

executors:
  # Use Node 18.18.2 and the root directory as the workspace
  executor_ui:
    working_directory: ~/statusphere-web
    docker:
      - image: cimg/node:18.18.2

  # Use Node 18.18.2 and the backend directory as the workspace
  executor_api:
    working_directory: ~/statusphere-web/backend
    resource_class: large
    docker:
      - image: cimg/node:18.18.2
      - image: postgres:alpine
        environment:
          POSTGRES_USER: test
          POSTGRES_PASSWORD: test
          POSTGRES_DB: testdb

  # backend-serverless directory as workspace
  executor_serverless:
    docker:
      - image: cimg/node:16.20.2

  # backend-events directory as workspace
  executor_events:
    docker:
      - image: cimg/node:16.20.2

commands:
  # Install npm dependencies
  install_deps:
    steps:
      - run: npm ci

  # Run jest-based tests with junit output
  run_unit_tests:
    description: "Run jest/vite-based tests with junit output"
    parameters:
      command:
        type: string
      junit_output:
        type: string
    steps:
      - run:
          name: Run Tests
          command: << parameters.command >>
          environment:
            JEST_JUNIT_OUTPUT: << parameters.junit_output >>

  setup_playwright:
    description: "Setup playwright and install dependencies"
    steps:
      - run:
          name: Install Playwright Browsers
          command: npx playwright install --with-deps

  run_e2e_tests:
    description: "Run playwright-based headless UI tests"
    steps:
      - run:
          name: Run Headless Playwright
          command: npm run test:e2e:ci

  notification:
    steps:
      # Call master production
      - when:
          condition:
            equal: [ master, << pipeline.git.branch >> ]
          steps:
            - jira/notify:
                environment: production
                environment_type: production
                job_type: deployment
                pipeline_id: << pipeline.id >>
                pipeline_number: << pipeline.number >>
      # Otherwise call it testing and assume it's in the dev environment
      - when:
          condition:
            not:
              equal: [ master, << pipeline.git.branch >> ]
          steps:
            - jira/notify:
                environment: dev
                environment_type: testing
                job_type: deployment
                pipeline_id: << pipeline.id >>
                pipeline_number: << pipeline.number >>
      - run: echo 0

  setup-ebcli:
    steps:
      - run:
          name: "Install pip and awsebcli"
          command: |
            sudo wget https://bootstrap.pypa.io/get-pip.py
            sudo python3 ./get-pip.py
            sudo pip install "pyyaml<5.4"
            sudo pip install --upgrade setuptools
            sudo pip install --upgrade pip awsebcli

jobs:
  # install and persist deps for frontend
  install_deps_ui:
    executor: executor_ui
    steps:
      - checkout
      - install_deps
      - persist_to_workspace:
          root: ~/statusphere-web
          paths:
            - ./node_modules

  # install and persist deps for backend
  install_deps_api:
    executor: executor_api
    steps:
      - checkout:
          path: ~/statusphere-web
      - install_deps
      - persist_to_workspace:
          root: ~/statusphere-web
          paths:
            - ./backend/node_modules

  test_e2e:
    executor: executor_api
    working_directory: ~/statusphere-web
    steps:
      - checkout
      - attach_workspace:
          at: ~/statusphere-web
      - run:
          name: Run backend server
          command: |
            cd ~/statusphere-web/backend
            npm run build
            npm run start
          background: true
      - run:
          name: Run frontend
          command: |
            cd ~/statusphere-web
            npm run start
          background: true
      - setup_playwright
      - run_e2e_tests

  # JOB: Run the UI unit tests, and bundle the UI
  test_and_bundle_ui:
    executor: executor_ui
    steps:
      - checkout
      - install_deps
      - run_unit_tests:
          command: |
            VITE_API_URL=http://test.ci.com \
            VITE_UI_URL=http://test.ui.com \
            npm run test:ci
          junit_output: test-results/jest/ui-test-results.xml
      - run:
          name: Build Webpack UI
          command: npm run build
      - store_test_results:
          path: test-results
      - persist_to_workspace:
          root: .
          paths:
            - dist

  # JOB: Deploy the React UI
  deploy_ui:
    executor: executor_ui
    steps:
      - checkout
      - attach_workspace:
          at: ~/statusphere-web
      - aws-cli/setup
      - run:
          name: Deploy UI
          command: |
            aws s3 sync dist/ s3://$s3_bucket --delete
            aws cloudfront create-invalidation --distribution-id $distribution_id --paths /index.html
      - notification
      - slack/notify:
          branch_pattern: master
          event: fail
          template: basic_fail_1
          mentions: "@devs"

  # JOB: Run the API unit tests
  test_backend:
    executor: executor_api
    steps:
      - checkout:
          path: ~/statusphere-web
      - attach_workspace:
          at: ~/statusphere-web
      - run_unit_tests:
          command: npm run test:ci
          junit_output: test-results/jest/backend-test-results.xml
      - run:
          name: Context values
          command: echo $to_host
      - store_test_results:
          path: test-results

  # JOB: Deploy the API
  deploy_backend:
    executor: executor_api
    steps:
      - checkout:
          path: ~/statusphere-web
      - install_deps
      - setup-ebcli
      - run:
          name: Deploy API
          command: eb deploy $eb_deploy_command_n18
      - slack/notify:
          branch_pattern: master
          event: fail
          template: basic_fail_1
          mentions: "@devs"

  notify_success:
    docker:
      - image: cimg/base:stable
    steps:
      - slack/notify:
          event: pass
          template: success_tagged_deploy_1
          branch_pattern: master

workflows:
  # only for non-dev, non-qa, and non-master branches
  dev:
    when: << pipeline.parameters.run-statusphere-workflow >>
    jobs:
      - install_deps_ui:
          filters:
            branches:
              ignore:
                - develop
                - qa
                - master
      - install_deps_api:
          filters:
            branches:
              ignore:
                - develop
                - qa
                - master
      - test_and_bundle_ui:
          requires:
            - install_deps_ui
          filters:
            branches:
              ignore:
                - develop
                - qa
                - master
      - test_backend:
          requires:
            - install_deps_api
          filters:
            branches:
              ignore:
                - develop
                - qa
                - master
      - test_e2e:
          requires:
            - install_deps_ui
            - install_deps_api
          filters:
            branches:
              ignore:
                - develop
                - qa
                - master
  # only for dev, qa, and master branches
  app:
    when: << pipeline.parameters.run-statusphere-workflow >>
    jobs:
      # ensure we have a FIFO queue setup so that deployments are in order
      - queue/block_workflow:
          limit-branch-name: master
          max-wait-time: '25'
          my-pipeline: <<pipeline.number>>
      - install_deps_ui:
          requires:
            - queue/block_workflow
          filters:
            branches:
              only:
                - develop
                - qa
                - master
      - install_deps_api:
          requires:
            - queue/block_workflow
          filters:
            branches:
              only:
                - develop
                - qa
                - master
      - test_and_bundle_ui:
          requires:
            - install_deps_ui
      - test_backend:
          requires:
            - install_deps_api
          filters:
            branches:
              only:
                - develop
                - qa
                - master
      - test_e2e:
          requires:
            - install_deps_ui
            - install_deps_api
          filters:
            branches:
              only:
                - develop
                - qa
                - master
      - deploy_backend:
          requires:
            - test_and_bundle_ui
            - test_backend
            - test_e2e
          context:
            - "backend-<< pipeline.git.branch >>"
            - "slack-secrets"
      - deploy_ui:
          requires:
            - deploy_backend
          context:
            - "ui-<< pipeline.git.branch >>"
            - "slack-secrets"
      - notify_success:
          requires:
            - deploy_backend
            - deploy_ui
          context:
            - "slack-secrets"
eddiewebb commented 6 months ago

@mustangJaro - check setup job output to make sure the generated yaml and arguments look legit. The statusphere.yml is valid config.

mustangJaro commented 6 months ago

Ok, thanks. Maybe the path-filtering orb is causing some issues, I'm not sure. We've been using that for over six months and haven't ran into this, but who knows.

Thanks for taking a look. I'll close this since it's unrelated.