-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: infer package manager from container exec and set package as an…
… interface (#237) * feat: support extra args * feat: drop dockerfile dep, rely on manifest * feat: support ubuntu image * update workflow * type fix in dependencies.ts * fix: tsc dependencies.ts * fix: update dist * throw errors if not finding correct fields * fix: update dist * fix: prevent field overwrite * fix: handle multiple colon * rely on dockerfil but support multiple args and ubuntu * cuda dockerfile test * drop delete logic * feat: pkg as interface * fix: drop dep change * feat: find pck manager * fix: dist * update tests * feat: drop init in main and seq through pkg managers * feat: test for unsupported pkg manager * fix: drop unsupported pkg test * unsupported pkg manager test * package manager tests * return dep.json
- Loading branch information
1 parent
b3ccf2a
commit a9335dd
Showing
15 changed files
with
142 additions
and
136 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
File renamed without changes.
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 @@ | ||
FROM ubuntu:latest |
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 @@ | ||
FROM busybox:latest |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,26 +1,24 @@ | ||
import {test, expect} from '@jest/globals' | ||
import * as path from 'path' | ||
import {load} from '../src/dockerfile' | ||
import {AlpineImage, DebImage} from '../src/image' | ||
|
||
test('load invalid dockerfile', () => { | ||
let dockerfilePath = path.join(__dirname, 'data', 'InvalidDockerfile') | ||
function loadInvalid() { | ||
load(dockerfilePath) | ||
} | ||
expect(loadInvalid).toThrowError('Unable to extract image from Dockerfile') | ||
}) | ||
|
||
test('load alpine dockerfile', () => { | ||
const dockerfilePath = path.join(__dirname, 'data', 'Dockerfile') | ||
const dockerfile = load(dockerfilePath) | ||
expect(dockerfile).toBeInstanceOf(AlpineImage) | ||
test('load alpine dockerfile', async () => { | ||
const dockerfilePath = path.join(__dirname, 'data', 'Dockerfile.apk') | ||
const dockerfile = await load(dockerfilePath) | ||
expect(dockerfile.pkgManager).toBe('apk') | ||
expect(dockerfile.name).toBe('alpine:latest') | ||
}) | ||
|
||
test('load debian dockerfile', () => { | ||
const dockerfilePath = path.join(__dirname, 'data', 'debianDockerfile') | ||
const dockerfile = load(dockerfilePath) | ||
expect(dockerfile).toBeInstanceOf(DebImage) | ||
expect(dockerfile.name).toBe('debian:bullseye-slim') | ||
test('load ubuntu dockerfile', async () => { | ||
const dockerfilePath = path.join(__dirname, 'data', 'Dockerfile.apt') | ||
const dockerfile = await load(dockerfilePath) | ||
expect(dockerfile.pkgManager).toBe('apt') | ||
expect(dockerfile.name).toBe('ubuntu:latest') | ||
}) | ||
|
||
test('load dockerfile with unsupported package manager', async () => { | ||
const dockerfilePath = path.join(__dirname, 'data', 'Dockerfile.unsupported') | ||
await expect(load(dockerfilePath)).rejects.toThrow( | ||
'Unable to find supported package manager' | ||
) | ||
}, 10000) |
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
Oops, something went wrong.