Giter Site home page Giter Site logo

ember-cli-deploy-revision-data's Introduction

Ember CLI Deploy

Build Status Code Climate

Simple, flexible deployment for your Ember CLI app

Installation

ember install ember-cli-deploy

Quick start

After installation, choose plugins matching your deployment environment, configure your deployment script appropriately and you're ready to start deploying.

In-depth documentation

Visit the Docs site

Contributing

Clone the repo and run npm install. To run tests,

npm test

ember-cli-deploy-revision-data's People

Contributors

achambers avatar alisdair avatar archit avatar beastawakens avatar cball avatar courajs avatar dependabot[bot] avatar duizendnegen avatar ember-tomster avatar fhightower avatar ghedamat avatar heroiceric avatar ibroadfo avatar jrowlingson avatar kkumler avatar kpfefferle avatar lcpriest avatar leizhao4 avatar lukemelia avatar michalbryxi avatar nathanpalmer avatar reidab avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ember-cli-deploy-revision-data's Issues

Handle error event when listing revision data

Hello guys,

There's clearly something wrong with my setup - but I'm not exactly sure what that is - running ember deploy --verbose env yields the following:

+- fetchInitialRevisions
|  |
|  +- redis
- Listing initial revisions for key: `sunlight-web-client`
events.js:160
      throw er; // Unhandled 'error' event

events.js:160
      throw er; // Unhandled 'error' event
      ^

Error: Timed out while waiting for handshake
    at Timeout._onTimeout (/Users/mariogintili/dev/sunlight/web-client/node_modules/ssh2/lib/client.js:569:19)
    at ontimeout (timers.js:365:14)
    at tryOnTimeout (timers.js:237:5)
    at Timer.listOnTimeout (timers.js:207:5)

I was wondering if we could handle that error event to show something more informative?

EDIT the unhandled error might not be in this library, sorry if that's the case

Deploy fail: `TypeError: path must be a string` (simple-git)

I have been getting this error lately:

$ ember deploy production
- TypeError: path must be a string
TypeError: path must be a string
TypeError: path must be a string
    at TypeError (native)
    at Object.fs.statSync (fs.js:844:18)
    at exists (/Users/ldx/Documents/project/node_modules/ember-cli-deploy-s3-pack/node_modules/ember-cli-deploy-revision-data/node_modules/simple-git/src/util/exists.js:7:21)
    at module.exports (/Users/ldx/Documents/project/node_modules/ember-cli-deploy-s3-pack/node_modules/ember-cli-deploy-revision-data/node_modules/simple-git/src/util/exists.js:28:11)
    at module.exports (/Users/ldx/Documents/project/node_modules/ember-cli-deploy-s3-pack/node_modules/ember-cli-deploy-revision-data/node_modules/simple-git/src/index.js:10:21)
    at /Users/ldx/Documents/project/node_modules/ember-cli-deploy-s3-pack/node_modules/ember-cli-deploy-revision-data/lib/scm-data-generators/git.js:14:7
    at initializePromise (/Users/ldx/Documents/project/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:588:5)
    at PromiseExt.Promise (/Users/ldx/Documents/project/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:1076:31)
    at new PromiseExt (/Users/ldx/Documents/project/node_modules/ember-cli/lib/ext/promise.js:32:8)
    at CoreObject.module.exports.CoreObject.extend.generate (/Users/ldx/Documents/project/node_modules/ember-cli-deploy-s3-pack/node_modules/ember-cli-deploy-revision-data/lib/scm-data-generatorPipeline aborted

The culprit is the latest version of the package [email protected] . If I pin it to 1.57.0 in my package.json it works again.

Different Environment doesn't work

Hello, I have a project in Ember and I'm doing the building process, on this proccess I'm using "revision-data" on pipeline, When I try to do deploy for production, everything works and you can see the expected results here:

drwxr-xr-x 1 mtzcpd604 1049089       0 Jan  4 17:36 ./
drwxr-xr-x 1 mtzcpd604 1049089       0 Jan  4 17:37 ../
drwxr-xr-x 1 mtzcpd604 1049089       0 Jan  3 17:32 fonts/
-rw-r--r-- 1 mtzcpd604 1049089  782533 Jan  4 17:36 frontresponsivo-cvc-cars-13f27e68b8f53d1fbda16b1ae7733fcc.js
-rw-r--r-- 1 mtzcpd604 1049089  565671 Jan  4 17:36 frontresponsivo-cvc-cars-baa8443ae38616b2cad48363accbdc69.css
drwxr-xr-x 1 mtzcpd604 1049089       0 Jan  3 17:32 images/
-rw-r--r-- 1 mtzcpd604 1049089   30952 Jan  4 17:36 vendor-0cf02e6a64ccf64b70b8463ed664a36d.css
-rw-r--r-- 1 mtzcpd604 1049089 2402745 Jan  4 17:36 vendor-fa34af23917ae2ae062315bf579228e1.js

But when I try to use another environment like "development" or "qa", file hash doesn't work like production, they don't have file hash, minify and other proccess from production pipeline, you can see the results here:

drwxr-xr-x 1 mtzcpd604 1049089       0 Jan  4 20:05 ./
drwxr-xr-x 1 mtzcpd604 1049089       0 Jan  4 20:06 ../
-rw-r--r-- 1 mtzcpd604 1049089   26702 Jan  4 20:05 failed.png
drwxr-xr-x 1 mtzcpd604 1049089       0 Jan  3 17:32 fonts/
-rw-r--r-- 1 mtzcpd604 1049089  785214 Jan  4 20:05 frontresponsivo-cvc-cars.css
-rw-r--r-- 1 mtzcpd604 1049089 1224496 Jan  4 20:05 frontresponsivo-cvc-cars.js
-rw-r--r-- 1 mtzcpd604 1049089 1438348 Jan  4 20:05 frontresponsivo-cvc-cars.map
drwxr-xr-x 1 mtzcpd604 1049089       0 Jan  3 17:32 images/
-rw-r--r-- 1 mtzcpd604 1049089   16445 Jan  4 20:05 passed.png
-rw-r--r-- 1 mtzcpd604 1049089    2550 Jan  4 20:05 test-loader.js
-rw-r--r-- 1 mtzcpd604 1049089    5641 Jan  4 20:05 test-support.css
-rw-r--r-- 1 mtzcpd604 1049089  243639 Jan  4 20:05 test-support.js
-rw-r--r-- 1 mtzcpd604 1049089  305131 Jan  4 20:05 test-support.map
-rw-r--r-- 1 mtzcpd604 1049089  116883 Jan  4 20:05 tests.js
-rw-r--r-- 1 mtzcpd604 1049089  145805 Jan  4 20:05 tests.map
-rw-r--r-- 1 mtzcpd604 1049089   38431 Jan  4 20:05 vendor.css
-rw-r--r-- 1 mtzcpd604 1049089 6268484 Jan  4 20:05 vendor.js
-rw-r--r-- 1 mtzcpd604 1049089 7456505 Jan  4 20:05 vendor.map

There are some functions that I know that I can do inside ember-cli-build, like:

 minifyJS: {
     enabled: true
    }

But I need the "file-hash" on my development environment, so I would like to do something like that, to solve my problem of file hash:

'revision-data': {
      enabled: true
    }

Is there some configuration, shortcut or something to notify the build proccess to change those files?

Deployment fails to prepare when using 'git-commit'

When using scm-data-generator 'git-commit' in CirlcleCI, prepare fails.

+- prepare
|  |
|  +- revision-data
|    - creating revision data using `git-commit`
|
+- didFail
TypeError: Cannot read property 'slice' of null
TypeError: Cannot read property 'slice' of null
    at CoreObject.module.exports.CoreObject.extend.generate (/home/ubuntu/the-order/node_modules/ember-cli-deploy-revision-data/lib/data-generators/git-commit.js:14:23)
    at Class.DeployPluginBase.extend._getData (/home/ubuntu/the-order/node_modules/ember-cli-deploy-revision-data/index.js:59:12)
    at Class.DeployPluginBase.extend.prepare (/home/ubuntu/the-order/node_modules/ember-cli-deploy-revision-data/index.js:36:24)
    at Object._pipeline.register.fn (/home/ubuntu/the-order/node_modules/ember-cli-deploy/lib/tasks/pipeline.js:144:21)
    at Pipeline._notifyPipelinePluginHookExecution (/home/ubuntu/the-order/node_modules/ember-cli-deploy/lib/models/pipeline.js:165:19)
    at lib$rsvp$$internal$$tryCatch (/home/ubuntu/the-order/node_modules/rsvp/dist/rsvp.js:1036:16)
    at lib$rsvp$$internal$$invokeCallback (/home/ubuntu/the-order/node_modules/rsvp/dist/rsvp.js:1048:17)
    at /home/ubuntu/the-order/node_modules/rsvp/dist/rsvp.js:331:11
    at lib$rsvp$asap$$flush (/home/ubuntu/the-order/node_modules/rsvp/dist/rsvp.js:1198:9)
    at doNTCallback0 (node.js:430:9)|
Pipeline aborted

Per @ghedamat the fix will likely need to happen in

https://github.com/ember-cli-deploy/ember-cli-deploy-revision-data/blob/master/lib/data-generators/git-commit.js

and also need to path these two lines

https://github.com/ember-cli-deploy/ember-cli-deploy-revision-data/blob/master/lib/scm-data-generators/git.js#L17-L18

Deployment fails with simple-git version 1.64.0, need to lock down version number

Running a deploy using git on a fresh install will fail with TypeError: path must be a string or Buffer. This is fixed by specifying the exact simple-git version in package.json:

"simple-git": "^1.47.0" -> "simple-git": "1.47.0"

Versions
simple-git: 1.64.0
ember-cli-deploy-revision-data: 0.3.0

Error from ember deploy staging --activate --verbose:

+- prepare
|  |
|  +- revision-data
- creating revision data using `file-hash`
- TypeError: path must be a string or Buffer
|
+- didFail
TypeError: path must be a string or Buffer
TypeError: path must be a string or Buffer
    at TypeError (native)
    at Object.fs.statSync (fs.js:987:18)
    at FSMonitor._measure (/Users/rsullivan/Desktop/my-app/node_modules/heimdalljs-fs-monitor/index.js:66:21)
    at Object.statSync (/Users/rsullivan/Desktop/my-app/node_modules/heimdalljs-fs-monitor/index.js:82:30)
    at exists (/Users/rsullivan/Desktop/my-app/node_modules/ember-cli-deploy-revision-data/node_modules/simple-git/src/util/exists.js:7:21)
    at module.exports (/Users/rsullivan/Desktop/my-app/node_modules/ember-cli-deploy-revision-data/node_modules/simple-git/src/util/exists.js:28:11)
    at module.exports (/Users/rsullivan/Desktop/my-app/node_modules/ember-cli-deploy-revision-data/node_modules/simple-git/src/index.js:10:21)
    at /Users/rsullivan/Desktop/my-app/node_modules/ember-cli-deploy-revision-data/lib/scm-data-generators/git.js:17:7
    at initializePromise (/Users/rsullivan/Desktop/my-app/node_modules/rsvp/dist/rsvp.js:588:5)

Git info is generated in the dist dir

The Git info is currently generated in the dist dir which causes problems if that dir is outside of the repo.

In our case we're deploying from a Docker container and mount the host's tmp dir as the tmp dir in the container. As that dir is a volume then and no regular folder any git operations performed in that dir won't work, leading to the error:

fatal: Not a git repository (or any parent up to mount point /usr/src/app/tmp)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

/usr/src/app/node_modules/ember-cli-deploy-revision-data/lib/scm-data-generators/git.js:16
        var info = log.latest;
                      ^

TypeError: Cannot read property 'latest' of null
    at /usr/src/app/node_modules/ember-cli-deploy-revision-data/lib/scm-data-generators/git.js:16:23
    at Git.<anonymous> (/usr/src/app/node_modules/simple-git/src/git.js:1276:13)
    at Git.<anonymous> (/usr/src/app/node_modules/simple-git/src/git.js:1192:21)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:885:16)
    at Socket.<anonymous> (internal/child_process.js:334:11)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at Pipe._handle.close [as _onclose] (net.js:501:12)
error Command failed with exit code 1.

The error in git.js being a consequence of the first 2 lines really:

fatal: Not a git repository (or any parent up to mount point /usr/src/app/tmp)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

export GIT_DISCOVERY_ACROSS_FILESYSTEM = 1 actually does fix the problem for us but it seems suspicious that the git info is generated from the dist dir as opposed to the root of the repo or working directory that ember deploy is run from.

Broken with broccoli-asset-rev 2.1.x

This plugin has a dev dependency on broccoli-asset-rev, which means that the version of broccoli-asset-rev accessed at runtime will likely depend on the version used by the containing app. Something about broccoli-asset-rev 2.1.x results in:

+- didBuild
|  |
|  +- revision-key
|    - creating revision key using `file-hash`
|    - Error: broccoli-filter must be passed an inputNode, instead it received `undefined`
|
+- didFail
Error: broccoli-filter must be passed an inputNode, instead it received `undefined`
Error: broccoli-filter must be passed an inputNode, instead it received `undefined`
    at Fingerprint.Filter (/Users/chrislopresto/p/yappbox/projects/account/node_modules/broccoli-asset-rev/node_modules/broccoli-filter/index.js:17:11)
    at new Fingerprint (/Users/chrislopresto/p/yappbox/projects/account/node_modules/broccoli-asset-rev/lib/fingerprint.js:17:10)
    at /Users/chrislopresto/p/yappbox/projects/account/node_modules/ember-cli-deploy-lightning-pack/node_modules/ember-cli-deploy-revision-key/lib/key-generators/file-hash.js:32:23
    at lib$rsvp$$internal$$tryCatch (/Users/chrislopresto/p/yappbox/projects/account/node_modules/ember-cli-deploy-lightning-pack/node_modules/ember-cli-deploy-revision-key/node_modules/rsvp/dist/rsvp.js:493:16)
    at lib$rsvp$$internal$$invokeCallback (/Users/chrislopresto/p/yappbox/projects/account/node_modules/ember-cli-deploy-lightning-pack/node_modules/ember-cli-deploy-revision-key/node_modules/rsvp/dist/rsvp.js:50
5:17)
    at lib$rsvp$$internal$$publish (/Users/chrislopresto/p/yappbox/projects/account/node_modules/ember-cli-deploy-lightning-pack/node_modules/ember-cli-deploy-revision-key/node_modules/rsvp/dist/rsvp.js:476:11)
    at Object.lib$rsvp$asap$$flush [as _onImmediate] (/Users/chrislopresto/p/yappbox/projects/account/node_modules/ember-cli-deploy-lightning-pack/node_modules/ember-cli-deploy-revision-key/node_modules/rsvp/dist
/rsvp.js:1198:9)
    at processImmediate [as _immediateCallback] (timers.js:354:15)|
Pipeline aborted

My recommendation is that we pull in an isolated implementation of fingerprinting rather than depend broccoli-asset-rev.

Generate data earlier in the deployment process

I was trying to use the revision data during the build step of the deployment process and was surprised I couldn't because it is only generated in the prepare step. I wonder why that is as it should be possible to generate the data earlier, e.g. in build or even earlier in configure or setup.

I'd be happy to submit a PR, just not sure there's a good reason maybe why the data isn't (or can't be) generated earlier in the process?

Cannot find module './lib/scm-data-generators'

I got the above error when running ember deploy build command. Here is the full stack trace:

Error: Cannot find module './lib/scm-data-generators'
Error: Cannot find module './lib/scm-data-generators'
    at Function.Module._resolveFilename (module.js:536:15)
    at Function.Module._load (module.js:466:25)
    at Module.require (module.js:579:17)
    at require (internal/module.js:11:18)
    at Object.scm (/Users/Serguei/projects/decastore/decastore-front/config/deploy.js:13:14)
    at Class.readConfig (/Users/Serguei/projects/decastore/decastore-front/node_modules/ember-cli-deploy-plugin/index.js:63:30)
    at Class._getScmData (/Users/Serguei/projects/decastore/decastore-front/node_modules/ember-cli-deploy-revision-data/index.js:63:37)
    at Class.prepare (/Users/Serguei/projects/decastore/decastore-front/node_modules/ember-cli-deploy-revision-data/index.js:37:23)
    at Object.fn (/Users/Serguei/projects/decastore/decastore-front/node_modules/ember-cli-deploy/lib/tasks/pipeline.js:93:21)
    at Pipeline._notifyPipelinePluginHookExecution (/Users/Serguei/projects/decastore/decastore-front/node_modules/ember-cli-deploy/lib/models/pipeline.js:173:19)
    at tryCatch (/Users/Serguei/projects/decastore/decastore-front/node_modules/rsvp/dist/rsvp.js:525:12)
    at invokeCallback (/Users/Serguei/projects/decastore/decastore-front/node_modules/rsvp/dist/rsvp.js:538:13)
    at /Users/Serguei/projects/decastore/decastore-front/node_modules/rsvp/dist/rsvp.js:606:14
    at flush (/Users/Serguei/projects/decastore/decastore-front/node_modules/rsvp/dist/rsvp.js:2415:5)
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
    at process._tickCallback (internal/process/next_tick.js:180:9)
Pipeline aborted

Here is deploy.js file:

/* eslint-env node */
'use strict';

module.exports = function(deployTarget) {
  let ENV = {
    build: {}
    // include other plugin configuration that applies to all deploy targets here
  };

  ENV["revision-data"] = {
    type: 'version-commit',
    scm: function(context) {
      return require('./lib/scm-data-generators')['git'];
    }
  }

  if (deployTarget === 'development') {
    ENV.build.environment = 'development';
    ENV.outputPath = 'dist';

    // configure other plugins for development deploy target here
  }

  if (deployTarget === 'production') {
    ENV.build.environment = 'production';
    // configure other plugins for production deploy target here
  }

  // Note: if you need to build some configuration asynchronously, you can return
  // a promise that resolves with the ENV object instead of returning the
  // ENV object synchronously.
  return ENV;
};

The folder it can't find is present in node_modules directory of the Ember app:
screen shot 2018-05-23 at 17 08 17

What's wrong here ? Thank you.
My settings:

ember-cli: 3.1.4
node: 8.9.1
os: darwin x64
"ember-cli-deploy-revision-data": "^1.0.0",

Crashes on non-git projects

scm is unavailable, leading to

simpleGit(_this.path).log(function(err, log) {
  var info = log.latest;

throwing an error.
Shall we just resolve with an empty response instead in case of !log?

Create revision metadata instead of just revision key

After discussions on slack, we decided that it would be beneficial to push a json object of metadata to the likes of redis. It makes sense for this plugin to create that metatdata object, with the revision key being one piece of the metadata, albeit the most important one.

Other data that could be added is the deployer, timestamp, git commit message etc etc.

It might also make sense to rename this repo to something more indicative of it's intention, maybe ember-cli-deploy-revision-data.

  • Rename repo
  • Implement new prepare hook

type: 'git-commit' doesn't work from git submodule

Related to rwjblue/git-repo-info#11

From a git submodule I get the following error

+- prepare
|  |
|  +- revision-data
|    - creating revision data using `git-commit`
|
+- didFail
TypeError: Cannot read property 'slice' of null
TypeError: Cannot read property 'slice' of null
  at CoreObject.module.exports.CoreObject.extend.generate (/home/ewan/projects/questionr/main/node_modules/ember-cli-deploy-revision-data/lib/data-generators/git-commit.js:14:23)

As a workaround in deploy.js I'm using

var exec = require('child_process').execSync;

....

redis: {
  revisionKey: function(){
    return exec('git rev-parse --short --verify HEAD').toString().replace('\n',''); 
  }
}

`git-commit` type fails with package `git-repo-info` version 1.3.0

The findRepo method in version 1.3.0 of git-repo-info no longer returns a string path for the repository path. It now returns an object literal with two values. This causes a path join to raise an exception.

- creating revision data using `git-commit`
|
+- didFail
TypeError: Path must be a string. Received { worktreeGitDir: '/srv/myapp/.git',
  commonGitDir: '/srv/myapp/.git' }
TypeError: Path must be a string. Received { worktreeGitDir: '/srv/myapp/.git',
  commonGitDir: '/srv/myapp/.git' }
    at assertPath (path.js:7:11)
    at Object.join (path.js:1211:7)
    at findRepo (/srv/myapp/client/node_modules/git-repo-info/index.js:43:20)
    at module.exports (/srv/myapp/client/node_modules/git-repo-info/index.js:144:21)
    at CoreObject.generate (/srv/myapp/client/node_modules/ember-cli-deploy-revision-data/lib/data-generators/git-commit.js:13:16)
    at Class._getData (/srv/myapp/client/node_modules/ember-cli-deploy-revision-data/index.js:59:12)
    at Class.prepare (/srv/myapp/client/node_modules/ember-cli-deploy-revision-data/index.js:36:24)
    at Object.fn (/srv/myapp/client/node_modules/ember-cli-deploy/lib/tasks/pipeline.js:159:21)
    at Pipeline._notifyPipelinePluginHookExecution (/srv/myapp/client/node_modules/ember-cli-deploy/lib/models/pipeline.js:175:19)
|
Pipeline aborted

Configuration

The configuration for this goes In the ember-cli-build.js file, correct?

var ENV = {
    build: {},
    redis: {
      allowOverwrite: true,
      keyPrefix: 'myapp'
    },
    s3: {
      prefix: 'myapp'
    }
  };

What is the parent key? I imagine that "type" is too generic to be a global setting, but I can't see anywhere in this repo that says what the parent key would be.

Doesn't work with Ember 3

After installation, all ember commands respond with

Cannot find module 'ember-cli/lib/ext/promise'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.