blob: a93e3c2f48747c6ab28ab167552c329a23c81316 [file] [log] [blame]
Arthur She6c913fe2025-04-29 22:37:37 -07001- job:
2 name: tf-m-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: GITLAB_REPO
11 default: 'https://gitlab.arm.com/tooling/qa-tools.git'
12 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"
17 - string:
18 name: GERRIT_PROJECT
19 default: 'https://review.trustedfirmware.org/ci/qa-tools'
20 description: "Destination repository, default is qa-tools Gerrit project"
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 - 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: ''
38
39 builders:
40 - shell: |-
41 #!/bin/bash
42 set -x
43
44 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}"
49
50 _workdir=$(mktemp -d)
51 trap '[ -d "${_workdir}" ] && rm -rf "${_workdir}"' EXIT
52
53 git -C "${_workdir}" init > /dev/null 2>&1
54
55 echo "Fetch ${GITLAB_REPO}:${SYNC_BRANCH}"
56 git -C "${_workdir}" fetch ${GITLAB_REPO} ${SYNC_BRANCH}
57 echo "Sync to ${GERRIT_PROJECT}"
Arthur Shea8d45932025-05-22 22:37:44 -070058 GIT_SSH_COMMAND="ssh ${SSH_PARAMS}" git -C "${_workdir}" push --force --tags ${REPO_SSH_URL} FETCH_HEAD:refs/heads/${SYNC_BRANCH}