Compare commits
53 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8cb86673ed | ||
|
|
6b500de774 | ||
| 6b26f12b9a | |||
| 08b304be38 | |||
|
|
e6f6342027 | ||
|
|
197c762909 | ||
| e4a88ea26b | |||
| cadbfac97e | |||
| 0f2098d884 | |||
| 8f25241cc8 | |||
| 0390fd17e7 | |||
| 11e271a368 | |||
| 30d300c7fd | |||
| 1cf7d117c7 | |||
| 7e2fd67729 | |||
| 245ebc8c2d | |||
| 119f854de5 | |||
|
|
c2925e425d | ||
|
|
b394aa9ee8 | ||
| e6231d837f | |||
|
|
dfb700aae4 | ||
|
|
e9b52ec54f | ||
|
|
695c4b3655 | ||
|
|
7b80ce48e1 | ||
|
|
ff72639dbb | ||
| 096225b537 | |||
| eb78e4bd7c | |||
| 44ff9a7c9a | |||
| 2ae6ccabb9 | |||
| df9bbd1d47 | |||
| 41c82e52b6 | |||
| 44fef1d926 | |||
| f0a1401018 | |||
| 54a838c2da | |||
| 550ba6df4a | |||
| 620ca572ff | |||
| 4674578d88 | |||
| 9913d0bcb3 | |||
| b24144cb4b | |||
| f568d5ba5b | |||
| 6e3673fced | |||
| f1a87650f0 | |||
| 29a221f449 | |||
| 2f556ceadc | |||
| 5e7d61c499 | |||
| 7f2a4e40d6 | |||
| 2052bcb96c | |||
| 9f4cfceee7 | |||
| 88ac743dda | |||
| 631ee88812 | |||
| 4565a6f7ba | |||
| ede4bb616d | |||
| f30ae06f45 |
105
.gitlab-ci.yml
105
.gitlab-ci.yml
@@ -1,36 +1,85 @@
|
|||||||
# 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 pull $CI_REGISTRY_IMAGE:latest || true
|
||||||
- docker push $IMAGE_TAG $CI_COMMIT_TAG
|
- >
|
||||||
|
docker build
|
||||||
|
--pull
|
||||||
|
--cache-from $CI_REGISTRY_IMAGE:latest
|
||||||
|
--tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
|
||||||
|
./Docker/
|
||||||
|
- 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
|
||||||
|
|
||||||
|
release_job:
|
||||||
|
stage: release
|
||||||
|
image: registry.gitlab.com/gitlab-org/release-cli:latest
|
||||||
|
rules:
|
||||||
|
- if: $CI_COMMIT_TAG
|
||||||
|
script:
|
||||||
|
- echo 'running release_job'
|
||||||
|
release:
|
||||||
|
name: 'Release $CI_COMMIT_TAG'
|
||||||
|
description: 'Created using the release-cli'
|
||||||
|
tag_name: '$CI_COMMIT_TAG'
|
||||||
|
ref: '$CI_COMMIT_TAG'
|
||||||
|
|
||||||
|
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:
|
||||||
|
- tags
|
||||||
|
script:
|
||||||
|
- docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
|
||||||
|
- docker tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA $CI_DOCKERHUB_IMAGE:$CI_COMMIT_REF_NAME $CI_DOCKERHUB_IMAGE:latest
|
||||||
|
- docker login -u "$CI_DOCKERHUB_USER" -p "$CI_DOCKERHUB_PASSWORD" $CI_DOCKERHUB_REGISTRY
|
||||||
|
- docker push $CI_DOCKERHUB_IMAGE:$CI_COMMIT_REF_NAME $CI_DOCKERHUB_IMAGE:latest
|
||||||
|
|
||||||
|
sast:
|
||||||
|
stage: test
|
||||||
|
include:
|
||||||
|
- template: Security/SAST.gitlab-ci.yml
|
||||||
|
|||||||
6
.gitlab/sast-ruleset.toml
Normal file
6
.gitlab/sast-ruleset.toml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
[bandit]
|
||||||
|
[[bandit.ruleset]]
|
||||||
|
disable = true
|
||||||
|
[bandit.ruleset.identifier]
|
||||||
|
type = "bandit_test_id"
|
||||||
|
value = "B101"
|
||||||
47
CHANGELOG.md
Normal file
47
CHANGELOG.md
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [1.6.8] - 2021-04-06
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Fixed slight issue with tagging
|
||||||
|
|
||||||
|
## [1.6.7] - 2021-04-06
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Updated base image to Python 3.9.4-alpine3.13
|
||||||
|
- Moved changes to this file
|
||||||
|
|
||||||
|
### Removed
|
||||||
|
|
||||||
|
- Changelog from README.md
|
||||||
|
|
||||||
|
## [1.6.6] - 2021-04-03
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Added CI/CD pipeline to project
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Moved project to my own personal Gitlab server for CI/CD pipelines as well as to run security scans on the container image and code
|
||||||
|
|
||||||
|
- Updated base image to Python 3.9.3-alpine3.12
|
||||||
|
|
||||||
|
## [Unversioned history]
|
||||||
|
|
||||||
|
- 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-03-08: Rebase to python 3.7.2-alpine3.9, update bottle and astral versions to latest
|
||||||
|
|
||||||
|
- 2019-01-03: Rebase to python 3.7.2-alpine3.8, changed logging level to Info (should output to /var/log/tHome/eagle.log)
|
||||||
|
|
||||||
|
- 2018-09-10: Ported to Python3, Added pricing info. Merged into master branch
|
||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
|
|
||||||
#==========================================================================
|
#==========================================================================
|
||||||
|
|||||||
@@ -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
|
||||||
|
|
||||||
#==========================================================================
|
#==========================================================================
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
apiVersion: extensions/v1beta1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: py-eagle-mqtt
|
name: py-eagle-mqtt
|
||||||
|
|||||||
Reference in New Issue
Block a user