Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sequential deployments with multiple project Ids #19

Open
jroho opened this issue Mar 10, 2024 · 0 comments
Open

Sequential deployments with multiple project Ids #19

jroho opened this issue Mar 10, 2024 · 0 comments

Comments

@jroho
Copy link

jroho commented Mar 10, 2024

Currently, it's impossible to run deployments to multiple projects within a single pipeline. This is not ideal behavior. The notes within the vercel-deployment-task-source indicate this should be possible. I believe have corrected the problem in the reconcileConfigurationInput. Please let me know if my assumptions are incorrect:

/**
 * To reconcile configuration inputs, get both the _input_ and the _environment variable_.
 *
 * If neither are defined, throw an error.
 *
 * If both are defined, log a warning that _input_ will be used.
 *
 * If _input_ is defined, and not _environment variable_, set the _environment variable_ to the _input_ value and return the _input_ value.
 *
 * If _environment variable_ is defined, and not _input_, return the _environment variable_ value.
 *
 * @param configurationInput
 * @returns
 */
function reconcileConfigurationInput(
  inputKey: string,
  envVarKey: string,
  name: string,
  defaultValue?: string
): string {
  const inputValue = getInput(inputKey);
  const envVarValue = getVariable(envVarKey);

  if (inputValue && envVarValue) {
    console.warn(
      `${name} specified by both \`${inputKey}\` input and \`${envVarKey}\` environment variable. Input field \`${inputKey}\` will be used.`
    );
  }

  if (inputValue) {
    setVariable(envVarKey, inputValue);
    return inputValue;
  } else if (envVarValue) {
    setVariable(envVarKey, envVarValue);
    return envVarValue;
  } else if (defaultValue) {
    setVariable(envVarKey, defaultValue);
    return defaultValue;
  } else {
    throw new Error(
      `${name} must be specified using input \`${inputKey}\` or environment variable \`${envVarKey}\``
    );
  }

The only workaround I've is resetting the environment variable "VERCEL_PROJECT_ID" between executions:

- script: | echo "##vso[task.setvariable variable=VERCEL_PROJECT_ID]"

reference: https://github.com/orgs/vercel/discussions/3442

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant