Add arthur-sync-qa-tools.yaml

Signed-off-by: Arthur She <arthur.she@linaro.org>
Change-Id: Iebd36bcff1a97bce017f27acf032074f9fa098af
diff --git a/arthur-sync-qa-tools.yaml b/arthur-sync-qa-tools.yaml
new file mode 100644
index 0000000..c70b500
--- /dev/null
+++ b/arthur-sync-qa-tools.yaml
@@ -0,0 +1,55 @@
+- 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: GERRIT_PROJECT
+        default: 'https://review.trustedfirmware.org/sandbox/arthur/qa-tools'
+        description: "Destination repository, default is qa-tools Gerrit project"
+    - string:
+        name: GITLAB_REPO
+        default: 'https://gitlab.arm.com/tooling/qa-tools'
+        description: "Source repository, default is qa-tools arm gitlab repo"
+    - string:
+        name: SYNC_BRANCH
+        default: 'master'
+        description: "The branch to sync"
+    properties:
+    - build-discarder:
+        num-to-keep: 30
+    publishers:
+    - email:
+        recipients: 'arthur.she@linaro.org'
+#  triggers:
+#      - timed: '59 23 * * 7'
+    wrappers:
+    - credentials-binding:
+      - text:
+          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
+        
+        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} ${SYNC_BRANCH}