Paulo De Mitri@paulogdm
[SOLVED] Project Linking and CI/CD pipelinesFebruary 13, 2020 at 9:19am (Edited 6 months ago)
So the CLI-command
now.jsonare deprecated. Currently I have several
now.jsonfiles in order to deploy our various staging environments:
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 Nowrecommend 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_PROJECT_IDenvironment 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
-S: Switch to team
--prod: alias the production URL to the deployment
-t: The secret authentication token
now.jsonI 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.
NOW_PROJECT_IDyou 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
*_DEVvariables 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