Skip to content

Commit

Permalink
fix(publish): better debugging of s3 deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
evansiroky committed Aug 9, 2018
1 parent 5fc3643 commit 84dac4d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 13 deletions.
6 changes: 6 additions & 0 deletions lib/definitions/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ This file is required to run and publish this java package. Please create a \`p
message: 'Error parsing `pom.xml` file.',
details: 'An error was encountered while reading the `pom.xml` file. Please make sure the file contains valid xml.'
}),
ES3DEPLOY: () => ({
message: 'Error copying to s3.',
details: `An error occurred while deploying the built jar file for an unknown reason.
Please check the logs on the CI server to see what happened.`
}),
ETOOLARGELASTRELEASEPOMDIFF: ({pomVersion, lastReleaseVersion}) => ({
message: 'Version mismatch',
details: `The pom.xml version of \`${pomVersion}\` differs too much from last git tag version of \`${lastReleaseVersion}\`.
Expand Down
8 changes: 8 additions & 0 deletions lib/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ async function publish (pluginConfig, context) {

// deploy jar to s3 bucket if cli option is set
const bucketFlagIdx = process.argv.indexOf('--deploy-to-s3-bucket')
let s3deployOk = true
if (bucketFlagIdx > -1) {
// assume that the bucket to deploy to is the next argument
const bucket = process.argv[bucketFlagIdx + 1]
Expand All @@ -60,6 +61,7 @@ async function publish (pluginConfig, context) {
} catch (e) {
console.error('error pushing to s3')
console.error(e)
s3deployOk = false
}
}

Expand All @@ -69,6 +71,11 @@ async function publish (pluginConfig, context) {

// make a commit bumping to snapshot version
await commitVersionInPomXml(`${nextSnapshotVersion.join('.')}-SNAPSHOT`, logger)

// only throw an error for s3 deployment after committing a new snapshot version
if (!s3deployOk) {
throw getError('ES3ES3DEPLOY')
}
}

/**
Expand Down Expand Up @@ -109,6 +116,7 @@ async function configureGit (repositoryUrl, logger) {
function exec () {
const childProcess = execa(...arguments)
childProcess.stdout.pipe(process.stdout)
childProcess.stderr.pipe(process.stderr)
return childProcess
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"dependencies": {
"@semantic-release/error": "^2.2.0",
"aggregate-error": "^1.0.0",
"execa": "^0.9.0",
"execa": "^0.10.0",
"fs-extra": "^5.0.0",
"got": "^8.0.1",
"semantic-release": "^15.8.1",
Expand Down
12 changes: 0 additions & 12 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2971,18 +2971,6 @@ execa@^0.7.0:
signal-exit "^3.0.0"
strip-eof "^1.0.0"

execa@^0.9.0:
version "0.9.0"
resolved "https://registry.yarnpkg.com/execa/-/execa-0.9.0.tgz#adb7ce62cf985071f60580deb4a88b9e34712d01"
dependencies:
cross-spawn "^5.0.1"
get-stream "^3.0.0"
is-stream "^1.1.0"
npm-run-path "^2.0.0"
p-finally "^1.0.0"
signal-exit "^3.0.0"
strip-eof "^1.0.0"

exit-hook@^1.0.0:
version "1.1.1"
resolved "https://registry.yarnpkg.com/exit-hook/-/exit-hook-1.1.1.tgz#f05ca233b48c05d54fff07765df8507e95c02ff8"
Expand Down

0 comments on commit 84dac4d

Please sign in to comment.