blob: f45002301242631bdbeae6aea6b44ee57af7f7e7 [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:
9 - string:
10 name: GERRIT_PROJECT
11 default: 'https://review.trustedfirmware.org/sandbox/arthur/qa-tools'
12 description: "Destination repository, default is qa-tools Gerrit project"
13 - string:
14 name: GITLAB_REPO
15 default: 'https://gitlab.arm.com/tooling/qa-tools'
16 description: "Source repository, default is qa-tools arm gitlab repo"
17 - string:
18 name: SYNC_BRANCH
19 default: 'master'
20 description: "The branch to sync"
21 properties:
22 - build-discarder:
23 num-to-keep: 30
24 publishers:
25 - email:
26 recipients: 'arthur.she@linaro.org'
27# triggers:
28# - timed: '59 23 * * 7'
29 wrappers:
30 - credentials-binding:
Arthur Sheef2bf172025-04-29 09:43:48 -070031 - ssh-user-private-key:
Arthur0bf47fe2025-04-29 09:20:07 -070032 credential-id: TFA_CI_BOT_USER_SSH_KEY
33 key-file-variable: CI_BOT_KEY
34 username-variable: CI_BOT_USERNAME
35 passphrase-variable: ''
Arthur Sheef2bf172025-04-29 09:43:48 -070036 - workspace-cleanup
37 - timestamps
Arthur0bf47fe2025-04-29 09:20:07 -070038
39 builders:
40 - shell: |-
41 #!/bin/bash
Arthur Sheef2bf172025-04-29 09:43:48 -070042
Arthur0bf47fe2025-04-29 09:20:07 -070043 SSH_PARAMS="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PubkeyAcceptedKeyTypes=+ssh-rsa -p 29418 -i ${CI_BOT_KEY}"
44 host=${GERRIT_PROJECT#*://}
45 GERRIT_HOST=${host%%/*}
46 REPO_PROJECT=${host#*/}
47 REPO_SSH_URL="ssh://${CI_BOT_USERNAME}@${GERRIT_HOST}:29418/${REPO_PROJECT}"
48
49 _workdir=$(mktemp -d)
50 trap '[ -d "${_workdir}" ] && rm -rf "${_workdir}"' EXIT
51
52 git -C "${_workdir}" init > /dev/null 2>&1
53
54 echo "Fetch ${GITLAB_REPO}:${SYNC_BRANCH}"
55 git -C "${_workdir}" fetch ${GITLAB_REPO} ${SYNC_BRANCH}
56 echo "Sync to ${GERRIT_PROJECT}"
57 GIT_SSH_COMMAND="ssh ${SSH_PARAMS}" git -C "${_workdir}" push ${REPO_SSH_URL} ${SYNC_BRANCH}