-
Notifications
You must be signed in to change notification settings - Fork 273
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(core): fold push task into build task
The push workflow doesn't really need to be separate from builds in the stack graph, since there is generally a 1:1 dependency relationship between the two, and pushing to clusters isn't needed as a discrete step.
- Loading branch information
Showing
24 changed files
with
160 additions
and
339 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
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
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
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,48 @@ | ||
/* | ||
* Copyright (C) 2018 Garden Technologies, Inc. <[email protected]> | ||
* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
|
||
import { BuildModuleParams, GetBuildStatusParams } from "../../../types/plugin/params" | ||
import { ContainerModule } from "../../container/config" | ||
import { containerHelpers } from "../../container/helpers" | ||
import { buildContainerModule, getContainerBuildStatus } from "../../container/build" | ||
|
||
export async function getBuildStatus(params: GetBuildStatusParams<ContainerModule>) { | ||
const status = await getContainerBuildStatus(params) | ||
|
||
const { ctx } = params | ||
|
||
if (ctx.provider.config.deploymentRegistry) { | ||
// TODO: Check if the image exists in the remote registry | ||
} | ||
|
||
return status | ||
} | ||
|
||
export async function buildModule(params: BuildModuleParams<ContainerModule>) { | ||
const buildResult = await buildContainerModule(params) | ||
|
||
const { ctx, module, log } = params | ||
|
||
if (!ctx.provider.config.deploymentRegistry) { | ||
return buildResult | ||
} | ||
|
||
if (!(await containerHelpers.hasDockerfile(module))) { | ||
return buildResult | ||
} | ||
|
||
const localId = await containerHelpers.getLocalImageId(module) | ||
const remoteId = await containerHelpers.getDeploymentImageId(module, ctx.provider.config.deploymentRegistry) | ||
|
||
log.setState({ msg: `Pushing image ${remoteId} to cluster...` }) | ||
|
||
await containerHelpers.dockerCli(module, ["tag", localId, remoteId]) | ||
await containerHelpers.dockerCli(module, ["push", remoteId]) | ||
|
||
return buildResult | ||
} |
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
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
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.