Hi,
I’m trying to implement a monorepo with Nx.dev and Lerna for versioning.
I’d like to tag my projects images with their versions with the following:
build:
title: “Running build”
type: “freestyle”
image: “node:14.9.0”
working_directory: “${{clone}}”
commands:
- “yarn nx affected --target=build --base=origin/master^ --prod --parallel”
# - “apt-get install jq”
# - “export VERSION=$(jq .version apps/advertiser-panel/package.json)”
# - “echo $VERSION”
stage: “test, lint and build monorepo”
build_advertiser_panel:
title: “Building advertiser-panel Docker image”
type: “build”
image_name: “advertiser-panel”
working_directory: “${{clone}}”
tag: $VERSION #“${{CF_BRANCH_TAG_NORMALIZED}}-${{CF_SHORT_REVISION}}”
dockerfile: “apps/advertiser-panel/Dockerfile”
stage: “build & deploy apps”
If the 1st commented code
# - “apt-get install jq”
# - “export VERSION=$(jq .version apps/advertiser-panel/package.json)”
# - “echo $VERSION”
will be on the build_advertiser_panel it will be perfect, as I need to tag several images with his own version (independent)
Another problem is I am trying to make build_advertiser_panel (second block of code) conditional.
Where the dir app/project1/dist exists. If dist inside project exists, then I must build the image and deplot on k8s.
Any help is welcome!