Compare commits
1 Commits
v1.7.8
...
add-networ
| Author | SHA1 | Date | |
|---|---|---|---|
| 26b955a1e8 |
105
.gitlab-ci.yml
105
.gitlab-ci.yml
@@ -4,30 +4,74 @@
|
|||||||
# See https://docs.gitlab.com/ee/ci/variables/#priority-of-environment-variables
|
# See https://docs.gitlab.com/ee/ci/variables/#priority-of-environment-variables
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
#- test
|
- test
|
||||||
- build
|
- build
|
||||||
#- push_local
|
- push_local
|
||||||
- release
|
- release
|
||||||
#- push_dockerhub
|
- push_dockerhub
|
||||||
|
|
||||||
|
.docker_base:
|
||||||
|
image: docker:18.09.7-dind
|
||||||
|
services:
|
||||||
|
- docker:18.09.7-dind
|
||||||
|
variables:
|
||||||
|
DOCKER_DRIVER: overlay
|
||||||
|
DOCKER_HOST: tcp://localhost:2375/
|
||||||
|
IMAGE_TAG: "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
|
||||||
|
FF_GITLAB_REGISTRY_HELPER_IMAGE: 1
|
||||||
|
before_script:
|
||||||
|
- docker version
|
||||||
|
- docker info
|
||||||
|
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
|
||||||
|
|
||||||
build:
|
build:
|
||||||
image: docker:24.0.5-dind
|
extends:
|
||||||
|
- .docker_base
|
||||||
stage: build
|
stage: build
|
||||||
services:
|
|
||||||
- name: docker:24.0.5-dind
|
|
||||||
command: ["--tls=false"]
|
|
||||||
variables:
|
|
||||||
DOCKER_DRIVER: overlay2
|
|
||||||
DOCKER_HOST: tcp://docker:2375
|
|
||||||
DOCKER_TLS_CERTDIR: ""
|
|
||||||
FF_GITLAB_REGISTRY_HELPER_IMAGE: 1
|
|
||||||
script:
|
script:
|
||||||
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
|
- docker pull $CI_REGISTRY_IMAGE:latest || true
|
||||||
- docker build -t $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA --build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') --build-arg VCS_REF=$CI_COMMIT_SHORT_SHA ./Docker/
|
- >
|
||||||
|
docker build
|
||||||
|
--pull
|
||||||
|
--cache-from $CI_REGISTRY_IMAGE:latest
|
||||||
|
--tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
|
||||||
|
--build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
|
||||||
|
--build-arg VCS_REF=$CI_COMMIT_SHORT_SHA
|
||||||
|
./Docker/
|
||||||
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
|
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
|
||||||
|
|
||||||
|
push local:
|
||||||
|
extends:
|
||||||
|
- .docker_base
|
||||||
|
stage: push_local
|
||||||
|
variables:
|
||||||
|
GIT_STRATEGY: none
|
||||||
|
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:
|
||||||
|
- 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
|
||||||
|
- 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
|
||||||
|
|
||||||
release:
|
release:
|
||||||
image: node:20.10.0-alpine3.18
|
image: node:13
|
||||||
stage: release
|
stage: release
|
||||||
only:
|
only:
|
||||||
refs:
|
refs:
|
||||||
@@ -37,17 +81,32 @@ release:
|
|||||||
- /^(([0-9]+)\.)?([0-9]+)\.x/
|
- /^(([0-9]+)\.)?([0-9]+)\.x/
|
||||||
# This matches pre-releases
|
# This matches pre-releases
|
||||||
- /^([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?$/
|
- /^([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?$/
|
||||||
except:
|
|
||||||
refs:
|
|
||||||
- tags
|
|
||||||
script:
|
script:
|
||||||
- touch CHANGELOG.md
|
- touch CHANGELOG.md
|
||||||
- apk add --no-cache git
|
- npm install @semantic-release/gitlab @semantic-release/changelog @semantic-release/git
|
||||||
- git config user.email "ci-bot@evanshome.io"
|
|
||||||
- git config user.name "ci-bot"
|
|
||||||
- npm install @semantic-release/gitlab@12.1.1 @semantic-release/changelog@6.0.3
|
|
||||||
@semantic-release/git@10.0.1 conventional-changelog-eslint@5.0.0
|
|
||||||
- npx semantic-release
|
- npx semantic-release
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
- CHANGELOG.md
|
- CHANGELOG.md
|
||||||
|
|
||||||
|
sast:
|
||||||
|
stage: test
|
||||||
|
include:
|
||||||
|
- template: Security/SAST.gitlab-ci.yml
|
||||||
|
|
||||||
|
sonarqube-check:
|
||||||
|
image:
|
||||||
|
name: sonarsource/sonar-scanner-cli:latest
|
||||||
|
entrypoint: [""]
|
||||||
|
variables:
|
||||||
|
SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache
|
||||||
|
GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task
|
||||||
|
cache:
|
||||||
|
key: "${CI_JOB_NAME}"
|
||||||
|
paths:
|
||||||
|
- .sonar/cache
|
||||||
|
script:
|
||||||
|
- sonar-scanner
|
||||||
|
allow_failure: true
|
||||||
|
only:
|
||||||
|
- master # or the name of your main branch
|
||||||
|
|||||||
@@ -1,38 +1,6 @@
|
|||||||
plugins:
|
plugins:
|
||||||
- - "@semantic-release/commit-analyzer"
|
- "@semantic-release/commit-analyzer"
|
||||||
- preset: eslint
|
- "@semantic-release/release-notes-generator"
|
||||||
releaseRules:
|
|
||||||
- tag: Breaking
|
|
||||||
release: major
|
|
||||||
- tag: Build
|
|
||||||
release: patch
|
|
||||||
- tag: Chore
|
|
||||||
release: minor
|
|
||||||
- tag: Fix
|
|
||||||
release: patch
|
|
||||||
- tag: New
|
|
||||||
release: minor
|
|
||||||
- tag: Update
|
|
||||||
release: minor
|
|
||||||
- tag: Upgrade
|
|
||||||
release: minor
|
|
||||||
- - "@semantic-release/release-notes-generator"
|
|
||||||
- preset: eslint
|
|
||||||
releaseRules:
|
|
||||||
- tag: Breaking
|
|
||||||
release: major
|
|
||||||
- tag: Build
|
|
||||||
release: patch
|
|
||||||
- tag: Chore
|
|
||||||
release: minor
|
|
||||||
- tag: Fix
|
|
||||||
release: patch
|
|
||||||
- tag: New
|
|
||||||
release: minor
|
|
||||||
- tag: Update
|
|
||||||
release: minor
|
|
||||||
- tag: Upgrade
|
|
||||||
release: minor
|
|
||||||
- - "@semantic-release/changelog"
|
- - "@semantic-release/changelog"
|
||||||
- changelogFile: CHANGELOG.md
|
- changelogFile: CHANGELOG.md
|
||||||
- "@semantic-release/gitlab"
|
- "@semantic-release/gitlab"
|
||||||
|
|||||||
38
CHANGELOG.md
38
CHANGELOG.md
@@ -1,41 +1,3 @@
|
|||||||
## [1.7.8](https://gitlab.evanshome.io/erichardson/py-eagle-mqtt/compare/v1.7.7...v1.7.8) (2023-12-03)
|
|
||||||
|
|
||||||
|
|
||||||
### ci
|
|
||||||
|
|
||||||
* fix semantic versioning and docker push to local registry ([9ce6bb5](https://gitlab.evanshome.io/erichardson/py-eagle-mqtt/commit/9ce6bb579847fba7fd31cc7ece4bcbb0661247b8))
|
|
||||||
|
|
||||||
### Fix
|
|
||||||
|
|
||||||
* semantic versioning and docker push to local registry ([08069d6](https://gitlab.evanshome.io/erichardson/py-eagle-mqtt/commit/08069d61d135eff8c2ee5b210279589c4e4eed8f))
|
|
||||||
|
|
||||||
## [1.7.6](https://gitlab.evanrichardsonphotography.com/erichardson/py-eagle-mqtt/compare/v1.7.5...v1.7.6) (2021-05-10)
|
|
||||||
|
|
||||||
|
|
||||||
### Build
|
|
||||||
|
|
||||||
* Change docker driver to overlay2 ([13cb517](https://gitlab.evanrichardsonphotography.com/erichardson/py-eagle-mqtt/commit/13cb51706b97f25486f62dd6985903e834d28ee2))
|
|
||||||
|
|
||||||
## [1.7.5](https://gitlab.evanrichardsonphotography.com/erichardson/py-eagle-mqtt/compare/v1.7.4...v1.7.5) (2021-05-09)
|
|
||||||
|
|
||||||
|
|
||||||
### Build
|
|
||||||
|
|
||||||
* push all tags instead of just latest ([b143379](https://gitlab.evanrichardsonphotography.com/erichardson/py-eagle-mqtt/commit/b143379f2018f410677a9646234e7b483d9277d3))
|
|
||||||
|
|
||||||
## [1.7.4](https://gitlab.evanrichardsonphotography.com/erichardson/py-eagle-mqtt/compare/v1.7.3...v1.7.4) (2021-05-09)
|
|
||||||
|
|
||||||
|
|
||||||
### Build
|
|
||||||
|
|
||||||
* cleanup long install line ([de1d073](https://gitlab.evanrichardsonphotography.com/erichardson/py-eagle-mqtt/commit/de1d073c6daf5d43fb7d9b7dafddd3b0cbcffc9b))
|
|
||||||
|
|
||||||
### ci
|
|
||||||
|
|
||||||
* Add git to node image ([6eb2d01](https://gitlab.evanrichardsonphotography.com/erichardson/py-eagle-mqtt/commit/6eb2d0145eff50c3243a364d821e769ae2ee06c9))
|
|
||||||
* change semantic release image to alpine to save space, updated to node 16 ([b1ca049](https://gitlab.evanrichardsonphotography.com/erichardson/py-eagle-mqtt/commit/b1ca0497b0b51e0c50ca1e5f99e5c8abd4224d53))
|
|
||||||
* Update DinD base to 20.10.6 and semantic release to node:15. Also pin sonar-scanner-cli to 4.6 ([589fb4f](https://gitlab.evanrichardsonphotography.com/erichardson/py-eagle-mqtt/commit/589fb4fcf7841d3c5f08327d7fb5d5c107562ed6))
|
|
||||||
|
|
||||||
## [1.7.3](https://gitlab.evanrichardsonphotography.com/erichardson/py-eagle-mqtt/compare/v1.7.2...v1.7.3) (2021-04-12)
|
## [1.7.3](https://gitlab.evanrichardsonphotography.com/erichardson/py-eagle-mqtt/compare/v1.7.2...v1.7.3) (2021-04-12)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
FROM python:3.11-alpine
|
FROM python:3.9.4-alpine3.13
|
||||||
LABEL maintainer="Evan Richardson (evanrich81[at]gmail.com)"
|
LABEL maintainer="Evan Richardson (evanrich81[at]gmail.com)"
|
||||||
|
|
||||||
ARG BUILD_DATE
|
ARG BUILD_DATE
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
paho-mqtt==1.6.1
|
paho-mqtt==1.5.1
|
||||||
bottle==0.12.25
|
bottle==0.12.19
|
||||||
defusedxml==0.7.1
|
defusedxml==0.7.1
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import json
|
|||||||
import bottle as B
|
import bottle as B
|
||||||
import tHome as T
|
import tHome as T
|
||||||
|
|
||||||
|
|
||||||
# ===========================================================================
|
# ===========================================================================
|
||||||
def meter(client, data, cfg):
|
def meter(client, data, cfg):
|
||||||
msg = {
|
msg = {
|
||||||
@@ -30,7 +31,8 @@ def meter( client, data, cfg ):
|
|||||||
"produced": data.Produced, # kWh
|
"produced": data.Produced, # kWh
|
||||||
}
|
}
|
||||||
|
|
||||||
return ( cfg.mqttEnergy, msg )
|
return cfg.mqttEnergy, msg
|
||||||
|
|
||||||
|
|
||||||
# ===========================================================================
|
# ===========================================================================
|
||||||
def instant(client, data, cfg):
|
def instant(client, data, cfg):
|
||||||
@@ -39,7 +41,8 @@ def instant( client, data, cfg ):
|
|||||||
"power": data.Power * 1000, # W
|
"power": data.Power * 1000, # W
|
||||||
}
|
}
|
||||||
|
|
||||||
return ( cfg.mqttPower, msg )
|
return cfg.mqttPower, msg
|
||||||
|
|
||||||
|
|
||||||
# ===========================================================================
|
# ===========================================================================
|
||||||
def price(client, data, cfg):
|
def price(client, data, cfg):
|
||||||
@@ -48,7 +51,18 @@ def price( client, data, cfg ):
|
|||||||
"price": data.Price,
|
"price": data.Price,
|
||||||
"tier": data.Tier,
|
"tier": data.Tier,
|
||||||
}
|
}
|
||||||
return ( cfg.mqttPrice, msg )
|
return cfg.mqttPrice, msg
|
||||||
|
|
||||||
|
|
||||||
|
# ===========================================================================
|
||||||
|
def network(client, data, cfg):
|
||||||
|
msg = {
|
||||||
|
"status": data.Status,
|
||||||
|
"description": data.Description,
|
||||||
|
"linkstrength": data.LinkStrength
|
||||||
|
}
|
||||||
|
return cfg.mqttNetwork, msg
|
||||||
|
|
||||||
|
|
||||||
# ===========================================================================
|
# ===========================================================================
|
||||||
handlers = {
|
handlers = {
|
||||||
@@ -59,13 +73,14 @@ handlers = {
|
|||||||
"InstantaneousDemand": instant,
|
"InstantaneousDemand": instant,
|
||||||
# "MessageCluster" :
|
# "MessageCluster" :
|
||||||
# "MeterInfo" :
|
# "MeterInfo" :
|
||||||
#"NetworkInfo" :
|
"NetworkInfo": network,
|
||||||
"PriceCluster": price,
|
"PriceCluster": price,
|
||||||
# "Reading" :
|
# "Reading" :
|
||||||
# "ScheduleInfo" :
|
# "ScheduleInfo" :
|
||||||
# "TimeCluster" :
|
# "TimeCluster" :
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# ===========================================================================
|
# ===========================================================================
|
||||||
|
|
||||||
@B.post('/')
|
@B.post('/')
|
||||||
@@ -90,6 +105,7 @@ def root_post():
|
|||||||
|
|
||||||
return "ok"
|
return "ok"
|
||||||
|
|
||||||
|
|
||||||
# ===========================================================================
|
# ===========================================================================
|
||||||
#
|
#
|
||||||
# Main applications script
|
# Main applications script
|
||||||
|
|||||||
@@ -23,6 +23,9 @@ mqttPrice = 'power/elec/Home/price'
|
|||||||
#Current rate label (returns rate label from meter)
|
#Current rate label (returns rate label from meter)
|
||||||
mqttRateLabel = 'power/elec/Home/ratelabel'
|
mqttRateLabel = 'power/elec/Home/ratelabel'
|
||||||
|
|
||||||
|
#Network Info Topic (returns status, description and link strength from meter)
|
||||||
|
mqttNetwork = 'power/elec/Home/network'
|
||||||
|
|
||||||
#===========================================================================
|
#===========================================================================
|
||||||
#
|
#
|
||||||
# Logging configuration. Env variables are allowed in the file name.
|
# Logging configuration. Env variables are allowed in the file name.
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
|
||||||
"extends": [
|
|
||||||
"config:base",
|
|
||||||
":semanticCommits"
|
|
||||||
],
|
|
||||||
"prConcurrentLimit": 5,
|
|
||||||
"labels": [
|
|
||||||
"upgrade",
|
|
||||||
"bot"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user