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

feat(ng-deploy): add option for buildTarget #2063

Closed
FrozenPandaz opened this issue May 6, 2019 · 13 comments
Closed

feat(ng-deploy): add option for buildTarget #2063

FrozenPandaz opened this issue May 6, 2019 · 13 comments

Comments

@FrozenPandaz
Copy link
Contributor

FrozenPandaz commented May 6, 2019

Current Behavior

Right now, the @angular/fire:deploy builder infers the build target to be targetProject:build:production. This makes it impossible to deploy targetProject:build:staging which may have different environment variables etc.

Expected Behavior

Option 1

Add an option for buildTarget so that the full targetProject:build:staging can be passed in and scheduled.

Personally, since schematics can generate the config via ng add or ng generate, I would opt for this one.

Option 2

Add an option for configuration so that staging can be passed in and targetProject:build:staging can be scheduled.

More Thoughts

Inferring the build target is okay, but I would rather not schedule anything at all if I leave it blank so a user can build separately ahead of time in the case Firebase Functions are someday supported. :)

Caveat

This configuration information might be important for knowing which Firebase project/ target to deploy to. This might be better done in a separate option.

@FrozenPandaz
Copy link
Contributor Author

cc @kirjs + @mgechev

@mgechev
Copy link
Member

mgechev commented May 6, 2019

This makes sense. Maybe call the option environment?

The advanced use case in the More Thoughts section we can plan in the future.

@JohannesHoppe
Copy link

I have started a discussion here about this topic. It would be great if we could find a common approach so that the expected behaviour and usability of the different builders are consistent.

Currently, there could be a majority for the following options:

  • --configuration (alias -c): A named build target, as specified in the "configurations" section of angular.json
  • --no-build: Skip build process during deployment

@mgechev
Copy link
Member

mgechev commented Aug 28, 2019

--configuration sounds good. I also find it coherent with the other CLI commands.

--no-build makes sense as well for advanced use cases.

@alan-agius4
Copy link
Contributor

alan-agius4 commented Jan 3, 2020

In the CLI, this same option is called browserTarget / serverTarget.

https://github.com/angular/angular-cli/blob/60746edc4cc6369c0fb3f6b69a5764b03e4379da/packages/angular_devkit/build_angular/src/app-shell/schema.json#L7-L16

configuration is misleading as it might be confused with configurations, I opt for buildTarget.

"deploy": {
    "builder": "@deploy:deploy-builder",
    "options": {
        "buildTarget": "project:browser"
    },
    "configurations": {
        "staging": {
            "buildTarget": "project:browser:staging"
        }
    }
},

Example

ng deploy --configurations staging

@wagnermaciel
Copy link
Contributor

@alan-agius4 safe to close this?

@alan-agius4
Copy link
Contributor

alan-agius4 commented Jan 30, 2020

Looks like it was addressed by #2063.

So this can be closed.

@Splaktar
Copy link
Member

When I do a deployment to staging, I need two things to happen

  1. Build my "staging" configuration in `projectname:build:staging"
  2. Deploy to my staging target in .firebaserc

PR #2063 only covers 1 as far as I can tell.
Is there any solution for 2?

The deploy docs are out dated and low on details.

@Splaktar
Copy link
Member

For now, it seems to always pick the first entry in the .firebaserc "targets": {} node. So you can swap those each time you want to change between production/staging.

But that's too fragile, so I'm just going to use something like the following and avoid ng deploy for now

"deploy": "npm run build:staging && firebase use staging && firebase deploy --only hosting",
"deploy:prod": "npm run build:prod && firebase use production && firebase deploy --only hosting",

@george43g
Copy link
Contributor

Just a heads up - I submitted a PR to allow configuring the firebase project deploy target as well. These can be actual projects or aliases you set up via the CLI or .firebaserc. There's an issue preventing the use of multiple configurations at the moment, so ng deploy myApp --configuration production does not yet work.

@george43g
Copy link
Contributor

When I do a deployment to staging, I need two things to happen

  1. Build my "staging" configuration in `projectname:build:staging"
  2. Deploy to my staging target in .firebaserc

PR #2063 only covers 1 as far as I can tell.
Is there any solution for 2?

The deploy docs are out dated and low on details.

And to finally make this possible, I've made a bug/feature request at the CLI end: angular/angular-cli#17332

This is to enable using the --configuration=production flag, or any environment you wish, that will set the buildTarget and firebaseProject options respectively.

@cfonger
Copy link

cfonger commented Oct 30, 2020

Seems like this is now implemented?

@jamesdaniels
Copy link
Member

More options dropped in 6.1.0-rc.1, we should have this covered now.

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

9 participants