amazon-archives / awsmobile-cli

CLI experience for Frontend developers in the JavaScript ecosystem.
Apache License 2.0
142 stars 35 forks source link

Issues configuring for CI/CD pipelines #174

Open nwayve opened 6 years ago

nwayve commented 6 years ago

This seems like a great tool for a personal side project, but when trying to integrate this into a CI/CD pipeline, I'm running into some problems.

No STS

It's already been mentioned in issue 126 about the lack of STS capabilities which requires a user to be created in a child org account with program access. So instead of having the CI/CD service role assume into the role with permissions to manage the MobileHub project, I have to store keys on the CI server that has to be updated when we rotate our keys on a regular basis =\

Can't Automate

Another issue is that the awsmobile-cli doesn't have a natural lib component to it to program against. Normally in these cases I'd just write scripts to perform the CLI actions but the awsmoblie configure aws command prompts for credentials instead of allowing them to be passed in with parameters (or by convention look for set environment variables). In order to achieve this I have to look into the library's bin folder to import files as the CLI does it, which is exceptionally bad practice (I stopped there).

Hard-coded user-profile references

After running the awsmobile init and configure aws commands, the project gets an /awsmobilejs/.awsmobile/info folder added. The aws-info.json file with an AWSConfigFilePath that points to a file in my user profile path C:\\Users\\me\\.awsmobilejs\\project-aws-config\\my-project-k3vTq.json. My question here would be, what files/folders should I .gitignore and have the CI server recreate, and with what commands?

So far, it's a great CLI utility for personal projects or POC projects, and I'm excited for the capabilities of AWS MobileHub, but as-is, I'm reluctant to use this for a production project.

aletheia commented 6 years ago

Hardcoded user profile references is really an issue that refrains from using it in multiple environments. I've managed it using awsmobile init in every environment, then versioning config files with env variables, but it's a porkaround and not the solution

UnleashedMind commented 6 years ago

Thanks for the feedbacks, I will mark this as feature request, we'll keep improving our products.

moreta commented 6 years ago

awsmobile configure aws allow parameter like this

awsmobile configure aws 1_your_aws_access_key_id 2_your_aws_secret_access_key 3_your_region

but there are not allowed parameter for awsmobile configure project. Eventually i use default value src, dist, npm run-script build, npm run-script serve

I setup my CI's pre_build phase like this

  pre_build:
    commands:
      - awsmobile configure aws 1_your_aws_access_key_id 2_your_aws_secret_access_key 3_your_region
      - awsmobile init 1_youraws_project_id -y

This works, but we need multiple environments support..