Commit 00615f08 authored by Jacob Priddy's avatar Jacob Priddy 👌

Merge branch 'deploy' into 'master'

Continuous Deployment

See merge request !8
parents 6f3da2b8 f1a6e625
Pipeline #9870 passed with stages
in 1 minute and 51 seconds
......@@ -3,6 +3,7 @@ image: gitlab.cs.wallawalla.edu:5050/elock/controller:latest
stages:
- build
- test
- deploy
build_tests:
stage: build
......@@ -20,11 +21,10 @@ build_tests:
build_esp32_application:
stage: build
script:
- echo $WEBSERVER_ROOT_CERT | base64 -d -w 0 > main/doorcode_root_cert.cert
- cp main/include/config.h.example main/include/config.h
- /opt/esp/entrypoint.sh bash
- idf.py build
# - echo "$SIGNING_KEY" | base64 -d -w 0 > decoded.pem
# - espsecure.py sign_data --keyfile decoded.pem --version 1 build/door-controller.bin
artifacts:
paths:
- build/door-controller.bin
......@@ -34,3 +34,26 @@ test_application:
stage: test
script:
- build/door-controller-universal-tests
deploy_controller_update:
stage: deploy
before_script:
- apt-get update -qq
- apt-get install -qq rsync
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
- eval $(ssh-agent -s)
- ssh-add <(echo "$SSH_PRIVATE_KEY" | base64 -d -w 0)
- mkdir -p ~/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
script:
- echo "$SIGNING_KEY" | base64 -d -w 0 > decoded.pem
- espsecure.py sign_data --keyfile decoded.pem --version 1 build/door-controller.bin
- version=$(<version.txt)
- deploy_name="v${version}.bin"
- echo "Deploying ${deploy_name}"
# Can't use the CI job token to deploy the artifact because that's a "pRemiUm FEATurE"
- "rsync build/door-controller.bin $SSH_USER@$SSH_HOST:/home/$SSH_USER/doorcode/src/backend/storage/app/controller/binaries/$deploy_name"
when: manual
only:
- master
config.h
doorcode_root_cert.cert
-----BEGIN CERTIFICATE-----
MIICBjCCAasCFE6D62CSKG+R8Lo/eclv4gmAmAW+MAoGCCqGSM49BAMCMIGDMQsw
CQYDVQQGEwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjEWMBQGA1UEBwwNQ29sbGVn
ZSBQbGFjZTEMMAoGA1UECgwDV1dVMSMwIQYDVQQLDBoxOTIuMTY4LjIuMSBST09U
IENBIElTU1VFUjEUMBIGA1UEAwwLMTkyLjE2OC4yLjEwIBcNMjAwNDEyMDYxMjU1
WhgPMjA3MDAzMzEwNjEyNTVaMIGDMQswCQYDVQQGEwJVUzETMBEGA1UECAwKV2Fz
aGluZ3RvbjEWMBQGA1UEBwwNQ29sbGVnZSBQbGFjZTEMMAoGA1UECgwDV1dVMSMw
IQYDVQQLDBoxOTIuMTY4LjIuMSBST09UIENBIElTU1VFUjEUMBIGA1UEAwwLMTky
LjE2OC4yLjEwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAT9CoZe2cYb1xv5MRCg
ybgLHYpkKqSyDTTUDHYyc7TjzY8GQ8B6emIWc25RVV81HfOjG2Q1kaKI9uvJfAlH
KJ/5MAoGCCqGSM49BAMCA0kAMEYCIQDlseat+9dox+pGRS5JBmcz+oXcAYB6Riag
7L1wKN5OSAIhANQP41FKl21YXTvIiVratEYrFpeeEV5Tc1Kh9yA8VDZW
-----END CERTIFICATE-----
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment