Skip to content

Commit

Permalink
kaniko digest
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladimir Chavkov committed Feb 12, 2024
1 parent 71609a7 commit df2608d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ inputs:
executor:
description: Image of Kaniko executor
required: true
default: gcr.io/kaniko-project/executor:v1.20.0
default: gcr.io/kaniko-project/executor:v1.20.1
cache:
description: Enable caching layers
required: true
Expand Down
15 changes: 11 additions & 4 deletions src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { promises as fs } from 'fs'
import * as os from 'os'
import * as path from 'path'


type Inputs = {
executor: string
cache: boolean
Expand Down Expand Up @@ -31,10 +32,16 @@ export const run = async (inputs: Inputs): Promise<Outputs> => {
withTime('Pulled', () => exec.exec('docker', ['pull', '-q', inputs.executor])),
)

const runnerTempDir = process.env.RUNNER_TEMP || os.tmpdir()
const outputsDir = await fs.mkdtemp(path.join(runnerTempDir, 'kaniko-action-'))
const args = generateArgs(inputs, outputsDir)
await withTime('Built', () => exec.exec('docker', args))
const directoryPath = path.join(__filename, ${outputsDir}); // replace 'your_directory' with your directory name

fs.readdir(directoryPath, function (err: NodeJS.ErrnoException | null, files: string[]) {
if (err) {
return console.log('Unable to scan directory: ' + err);
}
files.forEach(function (file: string) {
console.log(file);
});
});

const digest = await readContent(`${outputsDir}/digest`)
core.info(digest)
Expand Down

0 comments on commit df2608d

Please sign in to comment.