- job: name: lkft-generic-build-gitlab project-type: freestyle defaults: global properties: - authorization: anonymous: - job-read - job-extended-read android-internal: - job-build - job-cancel - build-discarder: days-to-keep: 180 num-to-keep: 450 artifact-num-to-keep: 1 parameters: - string: name: BUILD_DIR default: lkft - string: name: ANDROID_BUILD_CONFIG default: '' - string: name: KERNEL_DESCRIBE - string: name: KERNEL_BRANCH - string: name: SRCREV_kernel - string: name: BUILD_REFERENCE_IMAGE_GZ_URL - string: name: MAKE_KERNELVERSION - string: name: TEST_OTHER_PLANS_OVERRIDE default: "" - string: name: ANDROID_BUILD_CONFIG_TO_BE_TRIGGERED default: "" - string: name: GITLAB_CALLBACK_URL default: "" - string: name: UPSTREAM_PIPELINE_URL default: "" disabled: false node: docker-bionic-android-lkft display-name: 'Generic CI Job to be triggered from gitlab' concurrent: true wrappers: - timestamps - build-name: name: '#${BUILD_NUMBER}-${KERNEL_DESCRIBE}-${KERNEL_BRANCH}-${ANDROID_BUILD_CONFIG}' - timeout: timeout: 500 - credentials-binding: - text: credential-id: ARTIFACTORIAL_TOKEN variable: ARTIFACTORIAL_TOKEN - text: credential-id: GITLAB_API_LKFT_TOKEN variable: GITLAB_API_TOKEN builders: - shell: !include-raw: lkft/common/builders-v2.sh - linaro-publish-token - shell: !include-raw: lkft/common/publisher-v2.sh - shell: | #!/bin/bash -ex env PUB_DEST="android/lkft/${JOB_NAME}/${BUILD_NUMBER}" DOWNLOAD_URL="http://snapshots.linaro.org/${PUB_DEST}" f_build_json="build.json" cat >"${f_build_json}" <<__EOF__ { "BUILD_URL": "${BUILD_URL}", "BUILD_NUMBER": "${BUILD_NUMBER}", "JOB_URL": "${JOB_URL}", "DOWNLOAD_URL": "${DOWNLOAD_URL}", "ANDROID_BUILD_CONFIG_TO_BE_TRIGGERED": "${ANDROID_BUILD_CONFIG_TO_BE_TRIGGERED}", "ANDROID_BUILD_CONFIG": "${ANDROID_BUILD_CONFIG}", "TEST_OTHER_PLANS_OVERRIDE": "${TEST_OTHER_PLANS_OVERRIDE}", "BUILD_REFERENCE_IMAGE_GZ_URL": "${BUILD_REFERENCE_IMAGE_GZ_URL}", "KERNEL_DESCRIBE": "${KERNEL_DESCRIBE}", "KERNEL_BRANCH": "${KERNEL_BRANCH}", "SRCREV_kernel": "${SRCREV_kernel}", "MAKE_KERNELVERSION": "${MAKE_KERNELVERSION}" } __EOF__ publishers: - postbuildscript: builders: - role: SLAVE build-on: - SUCCESS - UNSTABLE - FAILURE - NOT_BUILT - ABORTED build-steps: - shell: | #!/bin/bash -ex # call gitlab api to notify the gitlab pipeline side that the build is finished successfully or not # only when the GITLAB_API_TOKEN and GITLAB_CALLBACK_URL are available if [ -n "${GITLAB_API_TOKEN}" ] && [ -n "${GITLAB_CALLBACK_URL}" ]; then cat >"variables.json" <<__EOF__ { "job_variables_attributes": [ { "key": "JENKINS_BUILD_URL", "value": "${BUILD_URL}" } ] } __EOF__ # https://docs.gitlab.com/ee/api/jobs.html#run-a-job curl --request POST \ --header "PRIVATE-TOKEN: ${GITLAB_API_TOKEN}" \ "${GITLAB_CALLBACK_URL}" \ --data @variables.json fi - archive: artifacts: '*.xml,*.json,*.txt' latest-only: true - email: recipients: 'lkft-maintainers@lists.linaro.org'