-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
It either pushes to the "unstable" channel if on the main branch, or the branch name if not.
- Loading branch information
Simon Emms
committed
Mar 30, 2022
1 parent
60a9c55
commit ebbcef2
Showing
3 changed files
with
40 additions
and
41 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { exec } from '../../util/shell'; | ||
import { Werft } from "../../util/werft"; | ||
import { JobConfig } from "./job-config"; | ||
|
||
const phases = { | ||
PUBLISH_KOTS: 'publish kots', | ||
}; | ||
|
||
const REPLICATED_SECRET = 'replicated'; | ||
const REPLICATED_YAML_DIR = './install/kots/manifests'; | ||
const INSTALLER_JOB_IMAGE = 'spec.template.spec.containers[0].image'; | ||
|
||
export async function publishKots(werft: Werft, config: JobConfig) { | ||
werft.phase(phases.PUBLISH_KOTS, 'Publish release to KOTS'); | ||
|
||
const imageAndTag = exec(`yq r ${REPLICATED_YAML_DIR}/gitpod-installer-job.yaml ${INSTALLER_JOB_IMAGE}`); | ||
const [image] = imageAndTag.split(':'); | ||
|
||
// Set the tag to the current version | ||
exec(`yq w -i ${REPLICATED_YAML_DIR}/gitpod-installer-job.yaml ${INSTALLER_JOB_IMAGE} ${image}:${config.version}`); | ||
|
||
const app = exec(`kubectl get secret ${REPLICATED_SECRET} --namespace werft -o jsonpath='{.data.app}' | base64 -d`); | ||
const token = exec(`kubectl get secret ${REPLICATED_SECRET} --namespace werft -o jsonpath='{.data.token}' | base64 -d`); | ||
|
||
const replicatedChannel = config.mainBuild ? 'Unstable' : config.repository.branch; | ||
|
||
exec(`replicated release create \ | ||
--lint \ | ||
--ensure-channel \ | ||
--app ${app} \ | ||
--token ${token} \ | ||
--yaml-dir ${REPLICATED_YAML_DIR} \ | ||
--version ${config.version} \ | ||
--release-notes "# ${config.version}\n\nSee [Werft job](https://werft.gitpod-dev.com/job/gitpod-build-${config.version}/logs) for notes" \ | ||
--promote ${replicatedChannel}`); | ||
|
||
werft.done(phases.PUBLISH_KOTS); | ||
} |