Skip to content

Commit

Permalink
Merge pull request #65 from stuartleeks/sl/align-users
Browse files Browse the repository at this point in the history
Align UID/GID between host/container
  • Loading branch information
stuartleeks authored Jun 27, 2021
2 parents 6200cc2 + c06fd36 commit e3b4473
Show file tree
Hide file tree
Showing 44 changed files with 1,174 additions and 252 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ jobs:
VERSION_SHORT: v${{ steps.build.outputs.version_short }}
run: |
echo "VERSION_SHORT: $VERSION_SHORT"
sudo chown -R $(whoami) .
# sudo chown -R $(whoami) .
git config user.name "CI build"
git config user.email [email protected]
git tag -fa $VERSION_SHORT -m $VERSION_SHORT
Expand Down
27 changes: 27 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Jest Debug opened file",
"type": "node",
"request": "launch",
"runtimeExecutable": "npm",
"args": [
"test",
"--",
// "--testPathPattern",
// "${fileBasenameNoExtension}",
"--runInBand",
"--all",
"--watchAll"
],
"cwd": "${workspaceRoot}/azdo-task/DevContainerBuildRun",
"protocol": "inspector",
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
},
]
}
2 changes: 1 addition & 1 deletion azdo-task/DevContainerBuildRun/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"@typescript-eslint/func-call-spacing": ["error", "never"],
"@typescript-eslint/no-array-constructor": "error",
"@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-extraneous-class": "error",
"@typescript-eslint/no-for-in-array": "error",
"@typescript-eslint/no-inferrable-types": "error",
Expand Down
18 changes: 18 additions & 0 deletions azdo-task/DevContainerBuildRun/__tests__/exec.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import {
exec
} from '../src/exec'

describe('exec', () => {
test('non-silent returns correct output', async () => {
const result = await exec('bash', ['-c', 'echo hi'], {silent: false})
console.log(result)
expect(result.exitCode).toBe(0)
expect(result.stdout).toStrictEqual('hi\n')
})
test('silent returns correct output', async () => {
const result = await exec('bash', ['-c', 'echo hi'], {silent: true})
console.log(result)
expect(result.exitCode).toBe(0)
expect(result.stdout).toStrictEqual('hi\n')
})
})
10 changes: 8 additions & 2 deletions azdo-task/DevContainerBuildRun/dist/docker.d.ts
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 buildImage(exec: ExecFunction, imageName: string, checkoutPath: string, subFolder: string): Promise<string>;
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;
10 changes: 9 additions & 1 deletion azdo-task/DevContainerBuildRun/dist/exec.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
export declare type ExecFunction = (command: string, args: string[]) => Promise<number>;
export interface ExecResult {
exitCode: number;
stdout: string;
stderr: string;
}
export interface ExecOptions {
silent?: boolean;
}
export declare type ExecFunction = (command: string, args: string[], options: ExecOptions) => Promise<ExecResult>;
Loading

0 comments on commit e3b4473

Please sign in to comment.