From 40b9adc5e34ec8a28da6180f9dbb864118f6c321 Mon Sep 17 00:00:00 2001
From: Benoit Lavenier <benoit.lavenier@e-is.pro>
Date: Thu, 24 Jun 2021 19:34:44 +0200
Subject: [PATCH] [fix] FIx CI build

---
 .gitlab-ci.yml   | 51 ++++++++++++++++++++++++++----------------------
 www/js/config.js |  2 +-
 2 files changed, 29 insertions(+), 24 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index a95906975..e075daaa0 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -16,25 +16,12 @@ stages:
 # ---------------------------------------------------------------
 
 variables:
-    CONTAINER_BUILD_IMAGE: $CI_REGISTRY_IMAGE/build:develop
+    CI_BUILD_IMAGE: $CI_REGISTRY_IMAGE/build:develop
 
 # ---------------------------------------------------------------
 # Jobs templates
 # ---------------------------------------------------------------
 
-.build:
-  stage: build
-  tags: [ redshift ]
-  script:
-    - yarn run build:web
-  after_script:
-    - ls -la dist/web/
-    - du -csh dist/web/
-  artifacts:
-    untracked: true
-    paths:
-      - dist/web
-    expire_in: 60 minutes
 
 .docker:
   image: docker:latest
@@ -42,20 +29,37 @@ variables:
   services:
     - docker:dind
   before_script:
-    - docker login -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} ${CI_REGISTRY} || true
+    - docker login -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} ${CI_REGISTRY}
+    #- docker login -u "duniterteam" -p "$DUNITERTEAM_PASSWD"
   after_script:
     - docker logout ${CI_REGISTRY}
+    #- docker logout
   allow_failure: false
 
 # ---------------------------------------------------------------
 # Build jobs
 # ---------------------------------------------------------------
 
-fast-build:
+.build:
+  stage: build
+  tags: [redshift]
+  script:
+    - yarn run build:web
+  after_script:
+    - ls -la dist/web/
+    - du -csh dist/web/
+  artifacts:
+    untracked: true
+    paths:
+      - dist/web
+    expire_in: 60 minutes
+
+build:
   extends: .build
-  image: ${CONTAINER_BUILD_IMAGE}
+  image: ${CI_BUILD_IMAGE}
   before_script:
     - mv /.build-cache/node_modules ./
+    - yarn run postinstall
   only:
     - develop
 
@@ -68,7 +72,7 @@ failsafe-build:
   only:
     - develop
 
-docker-for-fast-build:
+docker:ci:
   extends: .docker
   stage: alt_build
   when: on_failure
@@ -77,15 +81,16 @@ docker-for-fast-build:
     # Prepare the Dockerfile
     - echo 'FROM node:12' > Dockerfile
     - echo 'WORKDIR /.build-cache' >> Dockerfile
+    - echo 'RUN mkdir -p /.build-cache' >> Dockerfile
     - echo 'COPY ./ ./' >> Dockerfile
-    - echo 'RUN du -s `find . -maxdepth 1 | egrep -v "^\.$"`>/before.txt' >> Dockerfile
+    - echo 'RUN du -s `find . -maxdepth 1 | egrep -v "^\.$"` > /.build-cache/install-before.txt' >> Dockerfile
     - echo 'RUN yarn' >> Dockerfile
-    - echo 'RUN du -s `find . -maxdepth 1 | egrep -v "^\.$"`>/after.txt' >> Dockerfile
-    - echo "RUN diff /before.txt /after.txt || true" >> Dockerfile
+    - echo 'RUN du -s `find . -maxdepth 1 | egrep -v "^\.$"` > /.build-cache/install-after.txt' >> Dockerfile
+    - echo "RUN diff /.build-cache/install-before.txt /.build-cache/install-after.txt || true" >> Dockerfile
     - echo 'WORKDIR /build' >> Dockerfile
     # Build image
-    - docker build --pull -t ${CONTAINER_BUILD_IMAGE} .
-    - docker push ${CONTAINER_BUILD_IMAGE}
+    - docker build --no-cache -t ${CI_BUILD_IMAGE} .
+    - docker push ${CI_BUILD_IMAGE}
 
 # ---------------------------------------------------------------
 # Deploy jobs
diff --git a/www/js/config.js b/www/js/config.js
index 70fef5e8b..9d4af94d1 100644
--- a/www/js/config.js
+++ b/www/js/config.js
@@ -108,7 +108,7 @@ angular.module("cesium.config", [])
 		}
 	},
 	"version": "1.6.12",
-	"build": "2021-06-22T13:41:45.032Z",
+	"build": "2021-06-24T17:30:04.013Z",
 	"newIssueUrl": "https://git.duniter.org/clients/cesium-grp/cesium/issues/new"
 })
 
-- 
GitLab