generated from actions/typescript-action
-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #59 from stuartleeks/sl/mounts
Add mount support
- Loading branch information
Showing
7 changed files
with
255 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import {parseMount} from '../src/docker' | ||
|
||
describe('parseMount', () => { | ||
|
||
test('handles type,src,dst', () => { | ||
const input = 'type=bind,src=/my/source,dst=/my/dest' | ||
const result = parseMount(input) | ||
expect(result.type).toBe('bind') | ||
expect(result.source).toBe('/my/source') | ||
expect(result.target).toBe('/my/dest') | ||
}) | ||
test('handles type,source,destination', () => { | ||
const input = 'type=bind,source=/my/source,destination=/my/dest' | ||
const result = parseMount(input) | ||
expect(result.type).toBe('bind') | ||
expect(result.source).toBe('/my/source') | ||
expect(result.target).toBe('/my/dest') | ||
}) | ||
test('handles type,source,target', () => { | ||
const input = 'type=bind,source=/my/source,target=/my/dest' | ||
const result = parseMount(input) | ||
expect(result.type).toBe('bind') | ||
expect(result.source).toBe('/my/source') | ||
expect(result.target).toBe('/my/dest') | ||
}) | ||
|
||
test('throws on unexpected option', () => { | ||
const input = 'type=bind,source=/my/source,target=/my/dest,made-up' | ||
const action = () => parseMount(input) | ||
expect(action).toThrow("Unhandled mount option 'made-up'") | ||
}) | ||
|
||
test('ignores readonly', () => { | ||
const input = 'type=bind,source=/my/source,target=/my/dest,readonly' | ||
const result = parseMount(input) | ||
expect(result.type).toBe('bind') | ||
expect(result.source).toBe('/my/source') | ||
expect(result.target).toBe('/my/dest') | ||
}) | ||
test('ignores ro', () => { | ||
const input = 'type=bind,source=/my/source,target=/my/dest,ro' | ||
const result = parseMount(input) | ||
expect(result.type).toBe('bind') | ||
expect(result.source).toBe('/my/source') | ||
expect(result.target).toBe('/my/dest') | ||
}) | ||
test('ignores readonly with value', () => { | ||
const input = 'type=bind,source=/my/source,target=/my/dest,readonly=false' | ||
const result = parseMount(input) | ||
expect(result.type).toBe('bind') | ||
expect(result.source).toBe('/my/source') | ||
expect(result.target).toBe('/my/dest') | ||
}) | ||
test('ignores ro with value', () => { | ||
const input = 'type=bind,source=/my/source,target=/my/dest,ro=0' | ||
const result = parseMount(input) | ||
expect(result.type).toBe('bind') | ||
expect(result.source).toBe('/my/source') | ||
expect(result.target).toBe('/my/dest') | ||
}) | ||
|
||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
import { ExecFunction } from './exec'; | ||
export declare function isDockerBuildXInstalled(exec: ExecFunction): Promise<boolean>; | ||
export declare function buildImage(exec: ExecFunction, imageName: string, checkoutPath: string, subFolder: string): Promise<void>; | ||
export declare function runContainer(exec: ExecFunction, imageName: string, checkoutPath: string, subFolder: string, command: string, envs?: string[]): Promise<void>; | ||
export declare function runContainer(exec: ExecFunction, imageName: string, checkoutPath: string, subFolder: string, command: string, envs?: string[], mounts?: string[]): Promise<void>; | ||
export declare function pushImage(exec: ExecFunction, imageName: string): Promise<void>; | ||
export interface DockerMount { | ||
type: string; | ||
source: string; | ||
target: string; | ||
} | ||
export declare function parseMount(mountString: string): DockerMount; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
import { ExecFunction } from './exec'; | ||
export declare function isDockerBuildXInstalled(exec: ExecFunction): Promise<boolean>; | ||
export declare function buildImage(exec: ExecFunction, imageName: string, checkoutPath: string, subFolder: string): Promise<void>; | ||
export declare function runContainer(exec: ExecFunction, imageName: string, checkoutPath: string, subFolder: string, command: string, envs?: string[]): Promise<void>; | ||
export declare function runContainer(exec: ExecFunction, imageName: string, checkoutPath: string, subFolder: string, command: string, envs?: string[], mounts?: string[]): Promise<void>; | ||
export declare function pushImage(exec: ExecFunction, imageName: string): Promise<void>; | ||
export interface DockerMount { | ||
type: string; | ||
source: string; | ||
target: string; | ||
} | ||
export declare function parseMount(mountString: string): DockerMount; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.