mirror of
https://github.com/kubevela/kubevela.git
synced 2026-04-20 17:47:15 +00:00
* Feat(workflow): tekton task * Feat(tools): random string * Fix(example): defintion fmt * Fix(rand): gosec weak random
56 lines
1.8 KiB
YAML
56 lines
1.8 KiB
YAML
apiVersion: core.oam.dev/v1beta1
|
|
kind: WorkflowStepDefinition
|
|
metadata:
|
|
name: build
|
|
namespace: vela-system
|
|
spec:
|
|
schematic:
|
|
cue:
|
|
template: |-
|
|
import ("vela/op")
|
|
|
|
parameter: {
|
|
repoUrl: string
|
|
dockerfile: string
|
|
image: string
|
|
}
|
|
|
|
let pushImage=image
|
|
|
|
build: op.#Task & {
|
|
name: "\(context.name)-\(context.stepId)"
|
|
namespace: context.namespace
|
|
|
|
// Declare workspaces that used to share data.
|
|
workspace: {
|
|
"code-dir": {}
|
|
}
|
|
|
|
steps: [
|
|
// git clone code repo.
|
|
{
|
|
name: "git-clone"
|
|
image: "git-image-with-pull-ssh"
|
|
workspaceMounts: [{workspace: workspace["code-dir"], mountPath: "/data/code"}]
|
|
script: """
|
|
#! /bin/bash
|
|
git clone \(repourl) /data/code
|
|
"""
|
|
},
|
|
// build and push image.
|
|
{
|
|
name: "build-image"
|
|
image: "gcr.io/kaniko-project/executor:v1.3.0"
|
|
workspaceMounts: [{workspace: workspace["code-dir"], mountPath: "/data/build"}]
|
|
script: """
|
|
#! /bin/bash
|
|
/kaniko/executor --dockerfile=/data/build/\(dockerfile) --context=/data/build --destination=\(pushImage)
|
|
"""
|
|
}]
|
|
}
|
|
|
|
// wait until deployment ready
|
|
wait: op.#ConditionalWait & {
|
|
continue: build.do.status.phase == "successed"
|
|
}
|