diff --git a/Dockerfile b/Dockerfile index b64686655..f1b9bd7dd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM alpine:3.15 AS nim-build -ARG NIM_PARAMS +ARG NIMFLAGS ARG MAKE_TARGET=wakunode2 ARG RLN=true @@ -16,11 +16,10 @@ COPY . . RUN git submodule update --init --recursive # Slowest build step for the sake of caching layers -RUN make -j$(nproc) deps +RUN make -j$(nproc) deps RLN="$RLN" # Build the final node binary -RUN make -j$(nproc) $MAKE_TARGET NIM_PARAMS="$NIM_PARAMS" RLN="$RLN" - +RUN make -j$(nproc) $MAKE_TARGET NIMFLAGS="$NIMFLAGS" RLN="$RLN" # ACTUAL IMAGE ------------------------------------------------------- FROM alpine:3.15 @@ -46,6 +45,7 @@ COPY --from=nim-build /app/build/$MAKE_TARGET /usr/local/bin/ # If rln enabled: fix for 'Error loading shared library vendor/rln/target/debug/librln.so: No such file or directory' COPY --from=nim-build /app/vendor/rln/target/debug/librln.so vendor/rln/target/debug/librln.so +COPY --from=nim-build /app/waku/v2/protocol/waku_rln_relay/parameters.key waku/v2/protocol/waku_rln_relay/parameters.key # Copy migration scripts for DB upgrades COPY --from=nim-build /app/waku/v2/node/storage/migration/migrations_scripts/ /app/waku/v2/node/storage/migration/migrations_scripts/ diff --git a/Makefile b/Makefile index 393ec506c..b3cd58daa 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ BUILD_SYSTEM_DIR := vendor/nimbus-build-system # -d:insecure - Necessary to enable Prometheus HTTP endpoint for metrics # -d:chronicles_colors:none - Necessary to disable colors in logs for Docker -DOCKER_IMAGE_NIM_PARAMS ?= -d:chronicles_colors:none -d:insecure +DOCKER_IMAGE_NIMFLAGS ?= -d:chronicles_colors:none -d:insecure EXCLUDED_NIM_PACKAGES := vendor/nim-dnsdisc/vendor @@ -215,7 +215,7 @@ docker-image: DOCKER_IMAGE_NAME ?= statusteam/nim-waku:$(DOCKER_IMAGE_TAG) docker-image: docker build \ --build-arg="MAKE_TARGET=$(MAKE_TARGET)" \ - --build-arg="NIM_PARAMS=$(DOCKER_IMAGE_NIM_PARAMS)" \ + --build-arg="NIMFLAGS=$(DOCKER_IMAGE_NIMFLAGS)" \ --tag $(DOCKER_IMAGE_NAME) . docker-push: diff --git a/ci/Jenkinsfile.prs b/ci/Jenkinsfile.prs index 5ab4d9ad5..78735fa0b 100644 --- a/ci/Jenkinsfile.prs +++ b/ci/Jenkinsfile.prs @@ -5,9 +5,9 @@ pipeline { parameters { string( - name: 'NIM_PARAMS', + name: 'NIMFLAGS', description: 'Flags for Nim compilation.', - defaultValue: params.NIM_PARAMS ?: '-d:disableMarchNative -d:insecure --parallelBuild:6' + defaultValue: params.NIMFLAGS ?: '-d:disableMarchNative -d:insecure --parallelBuild:6' ) string( name: 'LOG_LEVEL', diff --git a/ci/Jenkinsfile.release b/ci/Jenkinsfile.release index 04cef3db2..87fe67d0e 100644 --- a/ci/Jenkinsfile.release +++ b/ci/Jenkinsfile.release @@ -29,9 +29,9 @@ pipeline { defaultValue: params.IMAGE_NAME ?: 'statusteam/nim-waku', ) string( - name: 'NIM_PARAMS', + name: 'NIMFLAGS', description: 'Flags for Nim compilation.', - defaultValue: params.NIM_PARAMS ?: '-d:disableMarchNative -d:chronicles_colors:none -d:insecure', + defaultValue: params.NIMFLAGS ?: '-d:disableMarchNative -d:chronicles_colors:none -d:insecure', ) } @@ -42,7 +42,7 @@ pipeline { "${params.IMAGE_NAME}:${env.GIT_COMMIT.take(8)}", "--label=commit='${env.GIT_COMMIT.take(8)}' " + "--build-arg=MAKE_TARGET='${params.MAKE_TARGET}' " + - "--build-arg=NIM_PARAMS='${params.NIM_PARAMS}' ." + "--build-arg=NIMFLAGS='${params.NIMFLAGS}' ." ) } } } diff --git a/docs/contributors/continuous-integration.md b/docs/contributors/continuous-integration.md index c3217ad65..6b1b03e11 100644 --- a/docs/contributors/continuous-integration.md +++ b/docs/contributors/continuous-integration.md @@ -24,7 +24,7 @@ Key part is the definition of four `parameters`: * `MAKE_TARGET` - Which `Makefile` target is built. * `IMAGE_TAG` - Tag of the Docker image to push. * `IMAGE_NAME` - Name of the Docker image to push. -* `NIM_PARAMS` - Nim compilation parameters. +* `NIMFLAGS` - Nim compilation parameters. The use of `?:` [Elvis operator](http://groovy-lang.org/operators.html#_elvis_operator) plays a key role in allowing parameters to be changed for each defined job in Jenkins without it being overridden by the `Jenkinsfile` defaults after every job run. ```groovy