canonical-hw-cert team mailing list archive
-
canonical-hw-cert team
-
Mailing list archive
-
Message #10677
[Merge] ~gavin.lin/hwcert-jenkins-jobs:cclm into hwcert-jenkins-jobs:master
Gavin Lin has proposed merging ~gavin.lin/hwcert-jenkins-jobs:cclm into hwcert-jenkins-jobs:master.
Commit message:
Put cc-lab-manager on Jenkins.
Requested reviews:
hwcert-jenkins (hwcert-jenkins)
For more details, see:
https://code.launchpad.net/~gavin.lin/hwcert-jenkins-jobs/+git/hwcert-jenkins-jobs/+merge/427902
--
Your team hwcert-jenkins is requested to review the proposed merge of ~gavin.lin/hwcert-jenkins-jobs:cclm into hwcert-jenkins-jobs:master.
diff --git a/jobs/infrastructure/cc-lab-manager/cc-lab-manager.yaml b/jobs/infrastructure/cc-lab-manager/cc-lab-manager.yaml
new file mode 100644
index 0000000..64b8574
--- /dev/null
+++ b/jobs/infrastructure/cc-lab-manager/cc-lab-manager.yaml
@@ -0,0 +1,47 @@
+- job-template:
+ name: '{prefix}-cc-lab-manager'
+ description: Run cc-lab-manager
+ project-type: freestyle
+ node: master
+ concurrent: false
+ sequential: false
+ triggers:
+ - timed: # every day
+ 'H 0 * * *'
+ properties:
+ - build-discarder:
+ num-to-keep: 10
+ wrappers:
+ - timestamps
+ - timeout:
+ timeout: 30
+ fail: true
+ - ssh-agent-credentials:
+ users:
+ - 'ssh-ce-certification-qa'
+ - 'jenkins-server-ssh-key'
+ - credentials-binding:
+ - file:
+ credential-id: cc-lab-manager-google
+ variable: CCLM_GOOGLE_TOKEN
+ - file:
+ credential-id: lp-credentials
+ variable: CCLM_LP_CREDENTIALS
+ - text:
+ credential-id: cert-maas-tel-01-password
+ variable: CCLM_MAAS_ADMIN_PASSWD
+ - text:
+ credential-id: c3api-ce-certification-qa
+ variable: CCLM_C3_APIKEY
+ builders:
+ - shell:
+ !include-raw: run-cc-lab-manager.sh
+ publishers:
+ - archive:
+ artifacts: '*.db'
+ allow-empty: true
+
+- project:
+ name: cc-lab-manager
+ jobs:
+ - '{prefix}-cc-lab-manager':
diff --git a/jobs/infrastructure/cc-lab-manager/run-cc-lab-manager.sh b/jobs/infrastructure/cc-lab-manager/run-cc-lab-manager.sh
new file mode 100644
index 0000000..18a4352
--- /dev/null
+++ b/jobs/infrastructure/cc-lab-manager/run-cc-lab-manager.sh
@@ -0,0 +1,60 @@
+#!/bin/bash
+set -ex
+
+#Remove previous venv
+rm -rf env
+cat <<EOF >build-env.sh
+{build_env}
+EOF
+. build-env.sh
+virtualenv -p python3 --system-site-packages env
+. env/bin/activate
+
+GITUSER="ce-certification-qa"
+if ! git -C "$WORKSPACE/cc-tool-box" pull; then
+ rm -rf "$WORKSPACE/cc-tool-box"
+ git clone git+ssh://$GITUSER@xxxxxxxxxxxxxxxxx/cc-tool-box "$WORKSPACE/cc-tool-box"
+fi
+if ! git -C "$WORKSPACE/c3-cli" pull; then
+ rm -rf "$WORKSPACE/c3-cli"
+ git clone git+ssh://$GITUSER@xxxxxxxxxxxxxxxxx/c3-cli "$WORKSPACE/c3-cli"
+fi
+if ! git -C "$WORKSPACE/cc-lab-manager" pull; then
+ rm -rf "$WORKSPACE/cc-lab-manager"
+ git clone git+ssh://$GITUSER@xxxxxxxxxxxxxxxxx/cc-lab-manager "$WORKSPACE/cc-lab-manager"
+fi
+if ! git -C "$WORKSPACE/cert-juju" pull; then
+ rm -rf "$WORKSPACE/cert-juju"
+ git clone git+ssh://$GITUSER@xxxxxxxxxxxxxxxxx/~canonical-hw-cert/hwcert-jenkins-jobs/+git/cert-juju "$WORKSPACE/cert-juju"
+fi
+
+export CCLM_HARDWARE_DB="$WORKSPACE/cert_lab_hwdb.db"
+export CCLM_GOOGLE_SHEET="https://docs.google.com/spreadsheets/d/1cRUUjjUFfy-JyOKFUEcW2qaujRn2fsXWDaXnClaV_9c/"
+export CCLM_CC_TOOL_BOX="$WORKSPACE/cc-tool-box"
+export CCLM_C3_USERNAME="ce-certification-qa"
+export CCLM_CERT_JUJU="$WORKSPACE/cert-juju"
+export CCLM_LP_CREDENTIALS="None"
+export CCLM_MAAS_ADMIN="admin"
+
+cp $WORKSPACE/cc-tool-box/config/c3-cli/my_conf.ini $WORKSPACE/c3-cli/c3/data/default.ini
+cd $WORKSPACE/c3-cli
+python3 setup.py install
+
+cp $WORKSPACE/cc-tool-box/config/cc_lab_manager/*.py $WORKSPACE/cc-lab-manager/cc_lab_manager/
+cd $WORKSPACE/cc-lab-manager
+python3 setup.py install
+cd $WORKSPACE
+mkdir -p c3/data/
+time cc-lab-manager
+
+cd "$WORKSPACE/cc-tool-box"
+git diff
+git add .
+git commit -m "Update by cc-lab-manager on $(date)"
+git push
+
+cd "$WORKSPACE/cert-juju"
+git diff
+git add .
+git commit -m "Update by cc-lab-manager on $(date)"
+git push
Follow ups