1
0
Fork 0
mirror of https://github.com/docker/build-push-action.git synced 2025-07-23 07:15:19 +02:00
docker-build-push-action/src/state-helper.ts
Claude ab514e31b5 *: introduce a setup-only mode to the build-push-action
This setup-only mode will setup a docker builder with the stickydisk
mounted but will not run a Docker build. The use case here is to allow
customers to then run their custom Tilt files or Docker commands against
our builder. The other subtle change is that we only cleanup in the post
step of this builder action. It is still to be seen if you can start several
of these builders at the same time in a workflow but we can do that as a follow
on.
2025-04-14 16:36:36 -07:00

68 lines
No EOL
2.7 KiB
TypeScript

import * as core from '@actions/core';
import {Inputs, sanitizeInputs} from './context';
export const tmpDir = process.env['STATE_tmpDir'] || '';
export const inputs = process.env['STATE_inputs'] ? JSON.parse(process.env['STATE_inputs']) : undefined;
export const buildRef = process.env['STATE_buildRef'] || '';
export const isSummarySupported = !!process.env['STATE_isSummarySupported'];
export const blacksmithDockerBuildId = process.env['STATE_blacksmithDockerBuildId'] || '';
export const blacksmithClientKey = process.env['STATE_blacksmithClientKey'] || '';
export const blacksmithClientCaCertificate = process.env['STATE_blacksmithClientCaCertificate'] || '';
export const blacksmithRootCaCertificate = process.env['STATE_blacksmithRootCaCertificate'] || '';
export const dockerBuildStatus = process.env['STATE_dockerBuildStatus'] || '';
export const blacksmithBuilderLaunchTime = process.env['STATE_blacksmithBuilderLaunchTime'] || '';
export const dockerBuildDurationSeconds = process.env['STATE_dockerBuildDurationSeconds'] || '';
export function setTmpDir(tmpDir: string) {
core.saveState('tmpDir', tmpDir);
}
export function setInputs(inputs: Inputs) {
core.saveState('inputs', JSON.stringify(sanitizeInputs(inputs)));
}
export function setBuildRef(buildRef: string) {
core.saveState('buildRef', buildRef);
}
export function setSummarySupported() {
core.saveState('isSummarySupported', 'true');
}
export function setBlacksmithDockerBuildId(blacksmithDockerBuildId: string) {
core.saveState('blacksmithDockerBuildId', blacksmithDockerBuildId);
}
// setBlacksmithBuilderLaunchTime sets the time (in seconds) it took to launch the Blacksmith builder
export function setBlacksmithBuilderLaunchTime(blacksmithBuilderLaunchTime: string) {
core.saveState('blacksmithBuilderLaunchTime', blacksmithBuilderLaunchTime);
}
export function setBlacksmithClientKey(blacksmithClientKey: string) {
core.saveState('blacksmithClientKey', blacksmithClientKey);
}
export function setBlacksmithClientCaCertificate(blacksmithClientCaCertificate: string) {
core.saveState('blacksmithClientCaCertificate', blacksmithClientCaCertificate);
}
export function setBlacksmithRootCaCertificate(blacksmithRootCaCertificate: string) {
core.saveState('blacksmithRootCaCertificate', blacksmithRootCaCertificate);
}
export function setDockerBuildStatus(dockerBuildStatus: string) {
core.saveState('dockerBuildStatus', dockerBuildStatus);
}
export function setDockerBuildDurationSeconds(dockerBuildDurationSeconds: string) {
core.saveState('dockerBuildDurationSeconds', dockerBuildDurationSeconds);
}
export function setExposeId(exposeId: string) {
core.saveState('exposeId', exposeId);
}
export function getExposeId(): string {
return core.getState('exposeId');
}