@codedependant/semantic-release-docker 4.4.0 → 4.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Semantic Release Docker
2
2
 
3
+ ## [4.5.1](https://github.com/esatterwhite/semantic-release-docker/compare/v4.5.0...v4.5.1) (2024-02-04)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **image**: account for stderr when looking for an image sha [ba9eec2](https://github.com/esatterwhite/semantic-release-docker/commit/ba9eec2888fb4478a3a90f741de41a155b6c525e) - Eric Satterwhite, closes: [#46](https://github.com/esatterwhite/semantic-release-docker/issues/46)
9
+
10
+ # [4.5.0](https://github.com/esatterwhite/semantic-release-docker/compare/v4.4.0...v4.5.0) (2023-10-20)
11
+
12
+
13
+ ### Features
14
+
15
+ * **config**: allow --quiet flag to be configurable [7abc74e](https://github.com/esatterwhite/semantic-release-docker/commit/7abc74ecdd96baa8d27ecb177defc137a64b482f) - Eric Satterwhite, closes: [#40](https://github.com/esatterwhite/semantic-release-docker/issues/40)
16
+
3
17
  # [4.4.0](https://github.com/esatterwhite/semantic-release-docker/compare/v4.3.0...v4.4.0) (2023-07-11)
4
18
 
5
19
 
@@ -26,6 +26,7 @@ async function buildConfig(build_id, config, context) {
26
26
  , dockerVerifyCmd: verifycmd = null
27
27
  , dockerNetwork: network = 'default'
28
28
  , dockerAutoClean: clean = true
29
+ , dockerBuildQuiet: quiet = true
29
30
  } = config
30
31
 
31
32
  let name = null
@@ -72,6 +73,7 @@ async function buildConfig(build_id, config, context) {
72
73
  , env: context.env
73
74
  , context: dockerContext
74
75
  , network: network
76
+ , quiet: typeCast(quiet) === true
75
77
  , clean: typeCast(clean) === true
76
78
  }
77
79
  }
@@ -1,9 +1,11 @@
1
1
  'use strict'
2
2
 
3
+ const os = require('os')
3
4
  const path = require('path')
4
5
  const crypto = require('crypto')
5
6
  const execa = require('execa')
6
7
  const array = require('../lang/array/index.js')
8
+ const SHA_REGEX = /(?:writing image\s)?[^@](?:sha\d{3}):(?<sha>\w+)/i
7
9
 
8
10
  class Image {
9
11
  constructor(opts) {
@@ -17,6 +19,7 @@ class Image {
17
19
  , cwd = process.cwd()
18
20
  , context = '.'
19
21
  , network = 'default'
22
+ , quiet = true
20
23
  } = opts || {}
21
24
 
22
25
  if (!name || typeof name !== 'string') {
@@ -37,6 +40,8 @@ class Image {
37
40
  , project: project
38
41
  , registry: registry
39
42
  }
43
+
44
+ if (quiet) this.flag('quiet', null)
40
45
  }
41
46
 
42
47
  get id() {
@@ -129,14 +134,13 @@ class Image {
129
134
  return [
130
135
  'build'
131
136
  , `--network=${this.network}`
132
- , '--quiet'
133
137
  , '--tag'
134
138
  , this.name
135
139
  , ...this.flags
136
140
  , '-f'
137
141
  , this.dockerfile
138
142
  , this.context
139
- ]
143
+ ].filter(Boolean)
140
144
  }
141
145
 
142
146
  async run(cmd) {
@@ -158,10 +162,18 @@ class Image {
158
162
  const stream = execa('docker', this.build_cmd)
159
163
  stream.stdout.pipe(process.stdout)
160
164
  stream.stderr.pipe(process.stderr)
161
- const {stdout} = await stream
162
- const [_, sha] = stdout.split(':')
163
- this.sha = sha.substring(0, 12)
164
- return this.sha
165
+ const {stdout, stderr} = await stream
166
+ const lines = (stdout || stderr).split(os.EOL)
167
+ const len = lines.length - 1
168
+
169
+ for (let x = len; x >= 0; x--) {
170
+ const line = lines[x]
171
+ const match = SHA_REGEX.exec(line)
172
+ if (match) {
173
+ this.sha = match.groups.sha.substring(0, 12)
174
+ return this.sha
175
+ }
176
+ }
165
177
  }
166
178
 
167
179
  async tag(tag, push = true) {
package/lib/prepare.js CHANGED
@@ -18,6 +18,7 @@ async function dockerPrepare(opts, context) {
18
18
  , cwd: cwd
19
19
  , context: opts.context
20
20
  , network: opts.network
21
+ , quiet: opts.quiet
21
22
  })
22
23
 
23
24
  const vars = buildTemplateVars(opts, context)
package/lib/publish.js CHANGED
@@ -16,6 +16,7 @@ async function publish(opts, context) {
16
16
  , build_id: opts.build
17
17
  , cwd: cwd
18
18
  , context: opts.context
19
+ , quiet: opts.quiet
19
20
  })
20
21
 
21
22
  const vars = buildTemplateVars(opts, context)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@codedependant/semantic-release-docker",
3
3
  "private": false,
4
- "version": "4.4.0",
4
+ "version": "4.5.1",
5
5
  "description": "docker package",
6
6
  "main": "index.js",
7
7
  "files": [