menu

ZEIT

Our mission is to make cloud computing as easy and accessible as mobile computing. You can find our Next.js community here.

Channels
Team

[SOLVED] Project Linking and CI/CD pipelines

February 13, 2020 at 9:19am
The 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 4 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.
  • reply
  • like
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 token
In 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.
  • reply
  • like
TheNOW_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.
like-fill
1
  • reply
  • like
TheNOW_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.
  • reply
  • like
It is kind of difficult to find the NOW_PROJECT_ID. I can set it up locally and then look inside the .now folder and remove that folder and repeat for the other environments. Is there an easier way to find this info?
Edited
  • reply
  • like
Not that I know of right now. Only other thing is writing a script that calls the zeit api, but since you only have to do this once, it is probably not worth your time.
like-fill
1
  • reply
  • like
You can run now locally and grab the values from .now/
  • reply
  • like
private
This channel has been archived