I'm trying to trigger the job via the api

This is the config.yml

version: 2.1

parameters:
  run_integration_tests:
    type: boolean
    default: false
    
  environment:
    type: string
    default: test.com
    
workflows:
  version: 2
  integration_tests:
    when: << pipeline.parameters.run_integration_tests >>
    jobs:
      - build

jobs:
  build:
    docker:
      - image: circleci/openjdk:8-jdk-stretch-browsers
      
    environment:
      # Customize the JVM maximum heap limit
      MAVEN_OPTS: -Xmx3200m

    steps:
      - checkout
      - run: mkdir test-reports
      - run:
          name: Download Selenium
          command: |
            curl -O http://selenium-release.storage.googleapis.com/3.5/selenium-server-standalone-3.5.3.jar
      - run:
          name: Start Selenium
          command: |
            java -jar selenium-server-standalone-3.5.3.jar -log test-reports/selenium.log
          background: true

      - run: mvn dependency:go-offline

      - save_cache:
          paths:
            - ~/.m2
          key: v1-dependencies-{{ checksum "pom.xml" }}

      # run tests!
      - run: mvn integration-test -Denv=<< pipeline.parameters.environment >>
      
      - run:
          name: Save test results
          command: |
            mkdir -p ~/testng/results/
            find . -type f -regex "./test-output/emailable-report.html" -exec cp {} ~/testng/results/ \;
          when: always
      - store_test_results:
          path: ~/testng/results/
      - store_artifacts:
          path: ~/testng/results/
      - store_artifacts:
          path:  testng/results/

And the api call is as follows

curl -u ${CIRCLECI_TOKEN}: -X POST --header "Content-Type: application/json" -d '{"parameters": {"run_integration_tests": true , "environment": testwebsite.com} }' https://circleci.com/api/v1.1/project/bb/kavya_n17/com.techcrunch.test/tree/master

When i pass the value << pipeline.parameters.environment >> in mvn integration test , the default value is taken and not what i pass in the curl command

Hi there,

Our v1.1 APIs don’t support Pipelines or Pipeline Parameters. If you POST the same body to https://circleci.com/api/v2/project/bb/kavya_n17/com.techcrunch.test/pipeline you should see things work as expected.

https://circleci.com/docs/api/v2/#trigger-a-new-pipeline has more info

-Gordon

Thanks for the response that did help me out

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.