Skip to content

Semantic release build stage#44

Merged
orangejulius merged 4 commits intomasterfrom
semantic-release-build-stage
Sep 1, 2018
Merged

Semantic release build stage#44
orangejulius merged 4 commits intomasterfrom
semantic-release-build-stage

Conversation

@orangejulius
Copy link
Copy Markdown
Member

This uses a new central CI script to run semantic release without putting it in dev-dependencies. See pelias/api#1187 for the full explanation.

By setting a flag on the console logger, we can easily convert all
outgoing logs with pelias-logger to a JSON format. Many of our log
statements already use structured formats, and by printing them in JSON,
they can all be readily parsed by almost any log-reading system (like
Kibana, Honeycomb, Splunk, etc).

In my testing, Winston essentialy checks if the flag is set to any
truthy value so `true`, "true", 3, "maybe" and anything else except
`null` and `false` will enable this feature. Since it's quite robust and
handles any valid value, it does not seem necessary to add any
validation ourselves.
This change moves semantic-release out of dev-dependencies, but keeps
its functionality by calling semantic-release as usual in a `release`
TravisCI build stage. There are several advantages to this method:

1.) semantic-release is run only after all builds succeed. Our previous
approach could have theoretically run semantic-release when some Node.js
versions failed with the current code
2.) semantic-release (and it's many dependencies) are removed from
`node_modules`. This increases the speed of `npm install` in all cases,
and reduces the size of our Docker images by 20MB (from 284MB to 264MB)!
Since the only time semantic-release is needed is on TravisCI anyway, it
seems pointless that every installation of Pelias should include it.
3.) Because semantic-release is not in `package.json`, Greenkeeper will
not attempt to update it. Semantic release updates _very_ frequently,
and each update attempt seems to have a decent chance of experiencing a
random TravisCI failure, causing unwanted notifications.

There are probably downsides to this approach. For example, we should
consider pinning the major version of semantic release during install.

Additionally, and for obvious reasons, we can't fully test this change
until it's merged to the `production` branch. We should consider testing
it first on a lower priority repository.

If this change _does_ work well, we should consider adopting it
everywhere.
As this is an NPM module, the master branch is where we do releases.
Running semantic-release anywhere else just wastes time on TravisCI.
@orangejulius orangejulius force-pushed the semantic-release-build-stage branch from f760de2 to 5d7d447 Compare September 1, 2018 13:10
@orangejulius orangejulius merged commit a1cf8d2 into master Sep 1, 2018
@orangejulius
Copy link
Copy Markdown
Member Author

Oops, this contained a feature i didn't mean it to. I reverted it from the master branch since I caught it right away.

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

Successfully merging this pull request may close these issues.

1 participant