Skip to content
Snippets Groups Projects
Commit 09929480 authored by Hugo SUBTIL's avatar Hugo SUBTIL
Browse files

update manifest + cicd

parent c259724c
No related branches found
No related tags found
1 merge request!6Feat/get consumption data
Pipeline #28471 passed
......@@ -6,8 +6,59 @@
# Note that environment variables can be set in several places
# See https://docs.gitlab.com/ee/ci/variables/#cicd-variable-precedence
stages:
- test
- test
- build
- publish
sast:
stage: test
include:
- template: Security/SAST.gitlab-ci.yml
- template: Security/SAST.gitlab-ci.yml
build-dev:
image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/node:16.14.2-alpine3.14
stage: build
before_script:
- apk add git
- apk add bash
script:
- yarn
- yarn build-dev
- git config --global user.name build-pipeline
- git config --global user.email "$GIT_USER"
- git config --global user.password "$GIT_PWD"
- git config user.email "$GIT_USER"
- git remote set-url origin https://"$GIT_USER":"$GIT_PWD"@forge.grandlyon.com/llle_project/enedis-sge-konnector.git
- git config --global credential.helper store
- yarn deploy-dev
only:
- dev
build:
image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/node:16.14.2-alpine3.14
stage: build
before_script:
- apk add git
- apk add bash
script:
- yarn
- yarn build
- git config --global user.name build-pipeline
- git config --global user.email "$GIT_USER"
- git config --global user.password "$GIT_PWD"
- git config user.email "$GIT_USER"
- git remote set-url origin https://"$GIT_USER":"$GIT_PWD"@forge.grandlyon.com/web-et-numerique/llle_project/enedis-sge-konnector.git
- git config --global credential.helper store
- yarn deploy
only:
- master
publish:
stage: publish
before_script:
- apk add git
script:
- yarn cozyPublish
only:
- tags
when: manual
......@@ -11,6 +11,15 @@
"categories": ["energy"],
"frequency": "daily",
"fields": {
"wso2BaseUrl": {
"type": "hidden"
},
"loginUtilisateur": {
"type": "hidden"
},
"apiToken": {
"type": "hidden"
},
"pdl": {
"type": "text"
},
......@@ -26,7 +35,8 @@
"screenshots": [],
"permissions": {
"accounts": {
"type": "io.cozy.accounts"
"type": "io.cozy.accounts",
"verbs": ["GET"]
},
"enedis data": {
"type": "com.grandlyon.enedis.*"
......
......@@ -134,16 +134,7 @@ async function getData(url, apiAuthKey, userLogin, pointId) {
apikey: apiAuthKey,
}
// If start date exceed the maximum amount of data we can get with one query
// get only 24 month
if (moment(endDate).diff(startDailyDate, 'months', true) > 24) {
log(
'info',
'Start date exceed 24 month, setting start date to current date minus 24 month'
)
startDailyDate = moment(endDate).subtract(24, 'month')
startDailyDateString = startDailyDate.format('YYYY-MM-DD')
}
setStartDate()
const { response } = await soapRequest({
url: url,
......@@ -185,16 +176,7 @@ async function getMaxPowerData(url, apiAuthKey, userLogin, pointId) {
apikey: apiAuthKey,
}
// If start date exceed the maximum amount of data we can get with one query
// get only 24 month
if (moment(endDate).diff(startDailyDate, 'months', true) > 24) {
log(
'info',
'Start date exceed 24 month, setting start date to current date minus 24 month'
)
startDailyDate = moment(endDate).subtract(24, 'month')
startDailyDateString = startDailyDate.format('YYYY-MM-DD')
}
setStartDate()
const { response } = await soapRequest({
url: url,
......@@ -217,6 +199,21 @@ async function getMaxPowerData(url, apiAuthKey, userLogin, pointId) {
)
}
/**
* If start date exceed the maximum amount of data we can get with one query
* get only 36 month
*/
function setStartDate() {
if (moment(endDate).diff(startDailyDate, 'months', true) > 36) {
log(
'info',
'Start date exceed 36 month, setting start date to current date minus 36 month'
)
startDailyDate = moment(endDate).subtract(36, 'month')
startDailyDateString = startDailyDate.format('YYYY-MM-DD')
}
}
/**
* Get half-hour data
* @param {string} url
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment