blob: 813ac87c1eb322afa0f078712261aa14faff6b34 [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:
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"
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 Sheef2bf172025-04-29 09:43:48 -070042
Arthur She572b7e72025-04-29 10:05:50 -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}"
Arthur0bf47fe2025-04-29 09:20:07 -070048
Arthur She572b7e72025-04-29 10:05:50 -070049 _workdir=$(mktemp -d)
50 trap '[ -d "${_workdir}" ] && rm -rf "${_workdir}"' EXIT
Arthur0bf47fe2025-04-29 09:20:07 -070051
Arthur She572b7e72025-04-29 10:05:50 -070052 git -C "${_workdir}" init > /dev/null 2>&1
Arthur0bf47fe2025-04-29 09:20:07 -070053
Arthur She572b7e72025-04-29 10:05:50 -070054 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}