[SOLVED] Project Linking and CI/CD pipelines
February 13, 2020 at 9:19amThe ZEIT community has a new home. This thread is preserved for historical purposes. The content of this conversation may be innaccurrate or out of date. Go to new community home →
[SOLVED] Project Linking and CI/CD pipelines
February 13, 2020 at 9:19am (Edited 12 months ago)So the CLI-command
-n
or name
property in now.json
are deprecated. Currently I have several now.json
files in order to deploy our various staging environments:- now.prod.json
- now.acc.json
- now.dev.json
The reason for this is so we can work with different environment variables and aliases/production urls. This will no longer work because of the deprecation. My question is what does
Zeit Now
recommend its users to do in order to deploy all the various staging environments with differing environment variables?Also the v17 CLI will prompt the CI/CD pipeline runners if the project should be linked to
xxx
. What should I do if I don't want to link to the suggested one but rather another name programmatically?February 13, 2020 at 9:45am
You can link the projects programmatically by providing
NOW_ORG_ID
and NOW_PROJECT_ID
environment variables in the CI. The values for this are the same as found in .now/project.json
. Although you might want to use a different project for each deployment, you need to fetch the project id by the API or the devtools of your browser.Work-around currently this with:
now -c -d -f -S $TEAM_NAME --prod -t $NOW_TOKEN
-c
: Confirm all questions
-d
: Debug trace
-f
: Force
-S
: Switch to team
--prod
: alias the production URL to the deployment
-t
: The secret authentication tokenIn
now.json
I still use the property name
. This is deprecated and will only work until it's completely removed. I hope someone from Zeit will clarify on a proper solution in the mean-time.The
NOW_ORG_ID
and NOW_PROJECT_ID
you only have to set this up once for every staging environment and then run something like:NOW_ORG_ID=$NOW_ORG_ID_DEV NOW_PROJECT_ID=$NOW_PROJECT_ID_DEV now -t $NOW_TOKEN
Where the
*_DEV
variables are the values for the dev environment.This is interesting stuff. I'm going to try it out. How did you come by this knowledge? When I do a search in the Zeit docs I can't find any mention of it.
From the now cli source: https://github.com/zeit/now/blob/master/packages/now-cli/src/util/projects/link.ts#L120
This channel has been archived