blob: c70b5007367d249285ccce317ee1220888d11fd7 [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:
31 - text:
32 credential-id: TFA_CI_BOT_USER_SSH_KEY
33 key-file-variable: CI_BOT_KEY
34 username-variable: CI_BOT_USERNAME
35 passphrase-variable: ''
36
37 builders:
38 - shell: |-
39 #!/bin/bash
40
41 SSH_PARAMS="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PubkeyAcceptedKeyTypes=+ssh-rsa -p 29418 -i ${CI_BOT_KEY}"
42 host=${GERRIT_PROJECT#*://}
43 GERRIT_HOST=${host%%/*}
44 REPO_PROJECT=${host#*/}
45 REPO_SSH_URL="ssh://${CI_BOT_USERNAME}@${GERRIT_HOST}:29418/${REPO_PROJECT}"
46
47 _workdir=$(mktemp -d)
48 trap '[ -d "${_workdir}" ] && rm -rf "${_workdir}"' EXIT
49
50 git -C "${_workdir}" init > /dev/null 2>&1
51
52 echo "Fetch ${GITLAB_REPO}:${SYNC_BRANCH}"
53 git -C "${_workdir}" fetch ${GITLAB_REPO} ${SYNC_BRANCH}
54 echo "Sync to ${GERRIT_PROJECT}"
55 GIT_SSH_COMMAND="ssh ${SSH_PARAMS}" git -C "${_workdir}" push ${REPO_SSH_URL} ${SYNC_BRANCH}