blob: 848d29a617ffcc5bcd37e55f6bf9df53fef6a4d8 [file] [log] [blame]
Arthur0bf47fe2025-04-29 09:20:07 -07001- job:
2 name: arthur-sync-qa-tools
3 node: docker-amd64-tf-a-jammy
4 project-type: freestyle
5 concurrent: false
6 description: Sync qa-tools from arm Gitlab to TF Gerrit
7 disabled: false
8 parameters:
Arthur She572b7e72025-04-29 10:05:50 -07009 - string:
Arthur She572b7e72025-04-29 10:05:50 -070010 name: GITLAB_REPO
Arthur She0c522e92025-04-29 21:19:21 -070011 default: 'https://gitlab.arm.com/tooling/qa-tools.git'
Arthur She572b7e72025-04-29 10:05:50 -070012 description: "Source repository, default is qa-tools arm gitlab repo"
13 - string:
14 name: SYNC_BRANCH
15 default: 'master'
16 description: "The branch to sync"
Arthur She0c522e92025-04-29 21:19:21 -070017 - string:
18 name: GERRIT_PROJECT
19 default: 'https://review.trustedfirmware.org/sandbox/arthur/qa-tools'
20 description: "Destination repository, default is qa-tools Gerrit project"
Arthur0bf47fe2025-04-29 09:20:07 -070021 properties:
Arthur She572b7e72025-04-29 10:05:50 -070022 - build-discarder:
23 num-to-keep: 30
Arthur0bf47fe2025-04-29 09:20:07 -070024 publishers:
Arthur She572b7e72025-04-29 10:05:50 -070025 - email:
26 recipients: 'arthur.she@linaro.org'
27# triggers:
Arthur0bf47fe2025-04-29 09:20:07 -070028# - timed: '59 23 * * 7'
29 wrappers:
Arthur She572b7e72025-04-29 10:05:50 -070030 - workspace-cleanup
31 - timestamps
32 - credentials-binding:
33 - ssh-user-private-key:
34 credential-id: TFA_CI_BOT_USER_SSH_KEY
35 key-file-variable: CI_BOT_KEY
36 username-variable: CI_BOT_USERNAME
37 passphrase-variable: ''
Arthur0bf47fe2025-04-29 09:20:07 -070038
39 builders:
Arthur She572b7e72025-04-29 10:05:50 -070040 - shell: |-
41 #!/bin/bash
Arthur She3b5e98f2025-04-29 22:28:33 -070042 set -x
Arthur Sheef2bf172025-04-29 09:43:48 -070043
Arthur She572b7e72025-04-29 10:05:50 -070044 SSH_PARAMS="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PubkeyAcceptedKeyTypes=+ssh-rsa -p 29418 -i ${CI_BOT_KEY}"
45 host=${GERRIT_PROJECT#*://}
46 GERRIT_HOST=${host%%/*}
47 REPO_PROJECT=${host#*/}
48 REPO_SSH_URL="ssh://${CI_BOT_USERNAME}@${GERRIT_HOST}:29418/${REPO_PROJECT}"
Arthur0bf47fe2025-04-29 09:20:07 -070049
Arthur She572b7e72025-04-29 10:05:50 -070050 _workdir=$(mktemp -d)
51 trap '[ -d "${_workdir}" ] && rm -rf "${_workdir}"' EXIT
Arthur0bf47fe2025-04-29 09:20:07 -070052
Arthur She572b7e72025-04-29 10:05:50 -070053 git -C "${_workdir}" init > /dev/null 2>&1
Arthur0bf47fe2025-04-29 09:20:07 -070054
Arthur She572b7e72025-04-29 10:05:50 -070055 echo "Fetch ${GITLAB_REPO}:${SYNC_BRANCH}"
56 git -C "${_workdir}" fetch ${GITLAB_REPO} ${SYNC_BRANCH}
57 echo "Sync to ${GERRIT_PROJECT}"
Arthur She3b5e98f2025-04-29 22:28:33 -070058 GIT_SSH_COMMAND="ssh ${SSH_PARAMS}" git -C "${_workdir}" push ${REPO_SSH_URL} FETCH_HEAD:refs/heads/${SYNC_BRANCH}