blob: 848d29a617ffcc5bcd37e55f6bf9df53fef6a4d8 [file] [log] [blame]
- job:
name: arthur-sync-qa-tools
node: docker-amd64-tf-a-jammy
project-type: freestyle
concurrent: false
description: Sync qa-tools from arm Gitlab to TF Gerrit
disabled: false
parameters:
- string:
name: GITLAB_REPO
default: 'https://gitlab.arm.com/tooling/qa-tools.git'
description: "Source repository, default is qa-tools arm gitlab repo"
- string:
name: SYNC_BRANCH
default: 'master'
description: "The branch to sync"
- string:
name: GERRIT_PROJECT
default: 'https://review.trustedfirmware.org/sandbox/arthur/qa-tools'
description: "Destination repository, default is qa-tools Gerrit project"
properties:
- build-discarder:
num-to-keep: 30
publishers:
- email:
recipients: 'arthur.she@linaro.org'
# triggers:
# - timed: '59 23 * * 7'
wrappers:
- workspace-cleanup
- timestamps
- credentials-binding:
- ssh-user-private-key:
credential-id: TFA_CI_BOT_USER_SSH_KEY
key-file-variable: CI_BOT_KEY
username-variable: CI_BOT_USERNAME
passphrase-variable: ''
builders:
- shell: |-
#!/bin/bash
set -x
SSH_PARAMS="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PubkeyAcceptedKeyTypes=+ssh-rsa -p 29418 -i ${CI_BOT_KEY}"
host=${GERRIT_PROJECT#*://}
GERRIT_HOST=${host%%/*}
REPO_PROJECT=${host#*/}
REPO_SSH_URL="ssh://${CI_BOT_USERNAME}@${GERRIT_HOST}:29418/${REPO_PROJECT}"
_workdir=$(mktemp -d)
trap '[ -d "${_workdir}" ] && rm -rf "${_workdir}"' EXIT
git -C "${_workdir}" init > /dev/null 2>&1
echo "Fetch ${GITLAB_REPO}:${SYNC_BRANCH}"
git -C "${_workdir}" fetch ${GITLAB_REPO} ${SYNC_BRANCH}
echo "Sync to ${GERRIT_PROJECT}"
GIT_SSH_COMMAND="ssh ${SSH_PARAMS}" git -C "${_workdir}" push ${REPO_SSH_URL} FETCH_HEAD:refs/heads/${SYNC_BRANCH}