Commit 6dc3fb50 authored by Jacob Priddy's avatar Jacob Priddy 👌

Update deploy procedure and some config defaults

parent 2fc2f977
image: gitlab.cs.wallawalla.edu:5050/elock/controller:latest
.get_version_from_tag:
variables:
VERSION: $CI_COMMIT_TAG
.get_version_from_build:
variables:
VERSION: 0.0.0.$CI_PIPELINE_ID
stages:
- build
- test
......@@ -18,42 +26,56 @@ build_tests:
- build/door-controller-universal-tests
expire_in: 1 hour
build_esp32_application:
test_application:
stage: test
script:
- build/door-controller-universal-tests
.build_esp32:
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
- echo $VERSION > version.txt
- /opt/esp/entrypoint.sh bash
- idf.py build
artifacts:
paths:
- build/door-controller.bin
- version.txt
expire_in: 2 months
test_application:
stage: test
script:
- build/door-controller-universal-tests
.build_head:
extends:
- .get_version_from_build
- .build_esp32
except:
refs:
- tags
.build_release:
extends:
- .get_version_from_tag
- .build_esp32
only:
refs:
- tags
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'
tags:
- elock
extends:
- .get_version_from_tag
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"
- 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
- chown 1000:1000 build/door-controller.bin
- mv build/door-controller.bin $PROJ_DIR/controller-bins/$deploy_name
only:
- master
refs:
- tags
......@@ -11,7 +11,7 @@
#define API_BASE_PATH "/api/door"
#define API_UPDATE_URL API_BASE_PATH "/update"
#define API_TIMEOUT_MS 10000
#define API_TIMEOUT_MS 3500
#define API_USE_SSL
#define API_NO_NAME_VERIFY
......@@ -30,7 +30,7 @@
// Every Day
#define SNTP_UPDATE_INTERVAL_MS (1000*60*60*24)
#define UPDATE_SKIP_VERSION_CHECK
//#define UPDATE_SKIP_VERSION_CHECK
#define DOOR_LATCH_PIN 19
......@@ -48,8 +48,8 @@
#define MIN_CODE_LENGTH 4
// 15 minutes
#define STATUS_MAX_NO_CONTACT_TIME_MS (1000 * 60 * 15)
// Time in MS we are allowed to go without contacting the server
#define STATUS_MAX_NO_CONTACT_TIME_MS (1000 * 60)
// How often to update the keypad state
#define KEYPAD_SCAN_PERIOD_MS 50
......
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