mardi 18 juin 2019

Trigger / execute another repo job (need only specific job triggered)

i'm currently setting up our qa team's repository yml file. so the dev team has their own repository, with it's own yml file, and so does the qa team.

so what do i want to achieve is, when the dev team committed something, the dev repo trigger the qa team's repo so the test will be executed afterwards.

for now, the yml of the dev team looks like this:

- build
- test

andbuildonly:
  environment: staging
  stage: build
  image: android-team-image-name
  script:
    - export BUILD_DIST_NAME=`date +%s`.tar.gz
    - tar -czvf $BUILD_DIST_NAME ./app/build/outputs/apk/staging/apk-staging.apk ./app/build/outputs/apk/staging/output.json
  only:
    - ci_tester
  artifacts:
    paths:
      - ./app/build/outputs/apk/staging/apk-staging.apk
    expire_in: 1 day


triggertestand:
  environment: staging
  stage: test
  image: qa-tester-image-name
  script:
    - "curl -X POST -F token=<my-token-here> -F ref=master https://git.office.com/api/v4/projects/17/trigger/pipeline"
  only:
    - ci_tester

so after the build stage done, the test stage (which configured in other yml file, on the qa team's repo yml) will be triggered.

for now, the yml of qa team looks like this:

  environment: sanity
  stage: sanity
  script:
    - robot --exitonfailure -i "sanityweb" --outputdir ./output WEB/SANITY_2.txt
    - export BUILD_DIST_NAME=robot-result_`date +%s`.tar.gz
    - tar -czvf $BUILD_DIST_NAME ./output/output.xml ./output/log.html ./output/report.html


this works fine, but it executes all jobs that is written on the qa team's yml file. how can i trigger only a specific job (instead of all jobs) defined on the qa team's yml from the dev team's yml file? do i need another api for this purpose?

Aucun commentaire:

Enregistrer un commentaire