Compare commits

..

51 Commits
1.5.2 ... 1.6.7

Author SHA1 Message Date
6b26f12b9a Pin base image version 2021-04-04 03:35:12 +00:00
08b304be38 Update README.md 2021-04-04 01:24:44 +00:00
Evan Richardson
e6f6342027 Add missing defusedxml package 2021-04-03 18:19:15 -07:00
Evan Richardson
197c762909 Add ignore rule for assert test 2021-04-02 15:00:44 -07:00
e4a88ea26b Fix SAST errors 2021-04-02 21:39:06 +00:00
cadbfac97e Replace xml.etree with defusedxml for SAST scans 2021-04-02 21:36:56 +00:00
0f2098d884 Merge branch 'set-sast-config-1' into 'master'
Set .gitlab-ci.yml to enable or configure SAST

See merge request erichardson/py-eagle-mqtt!1
2021-04-02 21:27:26 +00:00
8f25241cc8 refactor ci file 2021-04-02 21:25:57 +00:00
0390fd17e7 Update .gitlab-ci.yml 2021-04-02 21:20:22 +00:00
11e271a368 Set .gitlab-ci.yml to enable or configure SAST 2021-04-02 21:14:57 +00:00
30d300c7fd Update Dockerfile 2021-03-05 05:42:56 +00:00
1cf7d117c7 Update .gitlab-ci.yml file 2021-03-04 22:55:39 +00:00
7e2fd67729 Update .gitlab-ci.yml file 2021-03-04 22:52:26 +00:00
245ebc8c2d Update .gitlab-ci.yml file 2021-03-04 22:47:24 +00:00
119f854de5 Update .gitlab-ci.yml file 2021-03-04 22:40:46 +00:00
Evan Richardson
c2925e425d Merge branch 'master' of https://gitlab.evanrichardsonphotography.com/erichardson/py-eagle-mqtt 2021-03-04 14:36:29 -08:00
Evan Richardson
b394aa9ee8 Add stage to push to docker hub 2021-03-04 14:36:24 -08:00
e6231d837f Update .gitlab-ci.yml file 2021-03-04 22:18:21 +00:00
Evan Richardson
dfb700aae4 move base image and variables out 2021-03-04 14:17:46 -08:00
Evan Richardson
e9b52ec54f Forgot docker build directory 2021-03-04 14:14:02 -08:00
Evan Richardson
695c4b3655 Add push stage 2021-03-04 14:12:49 -08:00
Evan Richardson
7b80ce48e1 Add feature flag to override registry 2021-03-04 14:04:59 -08:00
Evan Richardson
ff72639dbb Fix variable name for MQTT_PASSWORD
update deployment api version
2021-03-04 14:02:30 -08:00
096225b537 Update dependencies to latest version 2021-03-04 21:51:04 +00:00
eb78e4bd7c Update .gitlab-ci.yml file 2021-03-03 02:09:17 +00:00
44ff9a7c9a Update .gitlab-ci.yml file 2021-03-03 02:08:10 +00:00
2ae6ccabb9 Update .gitlab-ci.yml file 2021-03-03 01:44:28 +00:00
df9bbd1d47 Update .gitlab-ci.yml file 2021-03-03 01:41:34 +00:00
41c82e52b6 Update .gitlab-ci.yml file 2021-03-03 01:41:19 +00:00
44fef1d926 Update .gitlab-ci.yml file 2021-03-03 01:40:03 +00:00
f0a1401018 Update .gitlab-ci.yml file 2021-03-03 01:37:09 +00:00
54a838c2da Update .gitlab-ci.yml file 2021-03-03 01:19:39 +00:00
550ba6df4a Update .gitlab-ci.yml file 2021-03-03 01:18:28 +00:00
620ca572ff Update .gitlab-ci.yml file 2021-03-03 01:13:41 +00:00
4674578d88 Update .gitlab-ci.yml file 2021-03-03 01:12:58 +00:00
9913d0bcb3 Update .gitlab-ci.yml file 2021-03-03 01:10:18 +00:00
b24144cb4b Update .gitlab-ci.yml file 2021-03-03 01:08:55 +00:00
f568d5ba5b Update .gitlab-ci.yml file 2021-03-03 01:08:52 +00:00
6e3673fced Update .gitlab-ci.yml file 2021-03-03 01:07:00 +00:00
f1a87650f0 Update .gitlab-ci.yml file 2021-03-03 01:04:41 +00:00
29a221f449 Update .gitlab-ci.yml file 2021-03-03 01:03:01 +00:00
2f556ceadc Update .gitlab-ci.yml file 2021-03-03 01:01:50 +00:00
5e7d61c499 Update .gitlab-ci.yml file 2021-03-03 01:00:37 +00:00
7f2a4e40d6 Update .gitlab-ci.yml file 2021-03-03 00:58:53 +00:00
2052bcb96c Update .gitlab-ci.yml file 2021-03-03 00:55:10 +00:00
9f4cfceee7 Update .gitlab-ci.yml file 2021-03-03 00:55:06 +00:00
88ac743dda Update .gitlab-ci.yml file 2021-03-03 00:55:03 +00:00
631ee88812 Update .gitlab-ci.yml 2021-03-03 00:53:57 +00:00
4565a6f7ba Update .gitlab-ci.yml 2019-12-21 03:18:46 +00:00
ede4bb616d Update .gitlab-ci.yml 2019-12-21 03:16:55 +00:00
f30ae06f45 Update .gitlab-ci.yml 2019-12-21 03:14:49 +00:00
9 changed files with 77 additions and 40 deletions

View File

@@ -1,36 +1,66 @@
# This file is a template, and might need editing before it works on your project. # You can override the included template(s) by including variable overrides
# Official docker image. # See https://docs.gitlab.com/ee/user/application_security/sast/#customizing-the-sast-settings
image: docker:latest # Note that environment variables can be set in several places
# See https://docs.gitlab.com/ee/ci/variables/#priority-of-environment-variables
services:
- docker:18.09-dind
stages: stages:
- build - test
- build
- push_local
- push_dockerhub
variables: .docker_base:
DOCKER_HOST: tcp://localhost:2375 image: docker:18.09.7-dind
DOCKER_DRIVER: overlay2 services:
#IMAGE_TAG: erichardson/py-eagle-mqtt:$CI_COMMIT_TAG - docker:18.09.7-dind
IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG variables:
DOCKER_DRIVER: overlay
before_script: DOCKER_HOST: tcp://localhost:2375/
- docker version IMAGE_TAG: "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
- docker info FF_GITLAB_REGISTRY_HELPER_IMAGE: 1
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY before_script:
- docker version
- docker info
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
build: build:
only: extends:
- tags - .docker_base
stage: build stage: build
script: script:
- docker build -t $IMAGE_TAG -t $CI_COMMIT_TAG ./Docker/ - docker build --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA ./Docker/
- docker push $IMAGE_TAG $CI_COMMIT_TAG - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
#build: push local:
# stage: build extends:
# script: - .docker_base
# - docker build --pull -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" . stage: push_local
# - docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" variables:
# except: GIT_STRATEGY: none
# - master only:
- master
script:
- docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
- docker tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA $CI_REGISTRY_IMAGE:latest
- docker push $CI_REGISTRY_IMAGE:latest
push dockerhub:
extends:
- .docker_base
stage: push_dockerhub
variables:
GIT_STRATEGY: none
CI_DOCKERHUB_IMAGE: index.docker.io/evanrich/py-eagle-mqtt
CI_DOCKERHUB_REGISTRY: docker.io
only:
- master
script:
- docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
- docker tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA $CI_DOCKERHUB_IMAGE:latest
- docker login -u "$CI_DOCKERHUB_USER" -p "$CI_DOCKERHUB_PASSWORD" $CI_DOCKERHUB_REGISTRY
- docker push $CI_DOCKERHUB_IMAGE:latest
sast:
stage: test
include:
- template: Security/SAST.gitlab-ci.yml

View File

@@ -0,0 +1,6 @@
[bandit]
[[bandit.ruleset]]
disable = true
[bandit.ruleset.identifier]
type = "bandit_test_id"
value = "B101"

View File

@@ -1,7 +1,7 @@
FROM python:3.7.4-alpine3.10 FROM python:3.9.3-alpine3.12
LABEL maintainer="Evan Richardson (evanrich81[at]gmail.com)" LABEL maintainer="Evan Richardson (evanrich81[at]gmail.com)"
LABEL version="1.5.1" LABEL version="1.6.6"
WORKDIR /app WORKDIR /app
COPY . /app COPY . /app

View File

@@ -1,4 +1,4 @@
astral==1.10.1 astral==2.2
paho-mqtt==1.4.0 paho-mqtt==1.5.1
bottle==0.12.17 bottle==0.12.19
defusedxml==0.7.1

View File

@@ -18,7 +18,7 @@ keepAlive = os.getenv('KEEPALIVE', 60)
# #
#=========================================================================== #===========================================================================
user = os.getenv('MQTT_USER', None) user = os.getenv('MQTT_USER', None)
password = os.getenv('MQTT_PASS', None) password = os.getenv('MQTT_PASSWORD', None)
#=========================================================================== #===========================================================================
# #
@@ -31,5 +31,3 @@ ca_certs = [
certFile = None certFile = None
keyFile = None keyFile = None

View File

@@ -6,7 +6,7 @@ from . import messages as msg
#from .InstantDemand import InstantDemand #from .InstantDemand import InstantDemand
#from .Reading import Reading #from .Reading import Reading
#from .Total import Total #from .Total import Total
import xml.etree.ElementTree as ET import defusedxml.ElementTree as ET
import socket import socket
#========================================================================== #==========================================================================

View File

@@ -3,7 +3,7 @@
# Parse XML messages into an object. # Parse XML messages into an object.
# #
#=========================================================================== #===========================================================================
import xml.etree.ElementTree as ET import defusedxml.ElementTree as ET
from . import messages from . import messages
#========================================================================== #==========================================================================

View File

@@ -4,6 +4,9 @@ Python3 based Docker for Eagle to MQTT reader
I have only ported this into a dockerfile, All Original code (with one minor modification for XML root tag) is credit to [Ted Drain - TD22057](https://github.com/TD22057/T-Home). I have only ported this into a dockerfile, All Original code (with one minor modification for XML root tag) is credit to [Ted Drain - TD22057](https://github.com/TD22057/T-Home).
## UPDATES: ## UPDATES:
2020-04-03: I've moved the repo to my private Gitlab server, with a mirror set up to github. I did this so that I could easily integrate a CI/CD pipeline to build this image, as well as run some Security tools against the image to improve it's code quality. Please continue to open bug reports/issues/pull requests here in Github. Also swapped to defusedxml python module due to security issues around xmltree. Forgot to incrememnt the build number, but docker container latest is up-to-date.
2019-07-24: Rebase to python 3.7.4-alpine3.10, update bottle to 0.12.17 2019-07-24: Rebase to python 3.7.4-alpine3.10, update bottle to 0.12.17
2019-04-12: Rebase to python 3.7.3-alpine3.9 2019-04-12: Rebase to python 3.7.3-alpine3.9

View File

@@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
name: py-eagle-mqtt name: py-eagle-mqtt