Skip to content

Commit

Permalink
Merge pull request #62 from balena-io-modules/stringified-cachefrom
Browse files Browse the repository at this point in the history
JSON stringify cachefrom option for builds
  • Loading branch information
flowzone-app[bot] authored Feb 27, 2025
2 parents 1bb90bb + 1b9d908 commit 7ec27fa
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
13 changes: 9 additions & 4 deletions .github/workflows/flowzone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ on:
pull_request:
types: [opened, synchronize, closed]
branches:
- "main"
- "master"
- 'main'
- 'master'
pull_request_target:
types: [opened, synchronize, closed]
branches:
- "main"
- "master"
- 'main'
- 'master'

jobs:
flowzone:
Expand All @@ -26,3 +26,8 @@ jobs:
github.event_name == 'pull_request_target'
)
secrets: inherit
with:
runs_on: >
[
"self-hosted", "X64"
]
4 changes: 3 additions & 1 deletion lib/multibuild/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ export function generateBuildTasks(
// translating to dockerode ImageBuildOptions properties
{
dockerOpts: {
...(cachefrom ? { cachefrom } : {}),
// TODO: JSON serialization should no longer be necessary
// if https://github.com/apocas/dockerode/pull/793 is merged
...(cachefrom ? { cachefrom: JSON.stringify(cachefrom) } : {}),
...(shmsize ? { shmsize } : {}),
...(target ? { target } : {}),
...(extrahosts ? { extrahosts } : {}),
Expand Down
2 changes: 1 addition & 1 deletion test/multibuild/build.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ describe('Specifying build options', async () => {
expect(newTask)
.to.have.property('dockerOpts')
.that.has.property('cachefrom')
.that.deep.equals(['alpine:latest']);
.that.deep.equals(JSON.stringify(['alpine:latest']));

expect(image).to.not.have.property('error');
});
Expand Down

0 comments on commit 7ec27fa

Please sign in to comment.