-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Define Tekton tasks in the devfile. #16304
Comments
cc @l0rd @vdemeester WDYT ? |
@sunix can you provide an example of such a devfile? Are you thinking about a new command type (i.e. |
maybe this can be related? #15752 I
this part.. won't this bring a big amount of additional data to the devfile? |
@l0rd |
for getting resources in tekton I have followed a guide with this as example: apiVersion: tekton.dev/v1alpha1
kind: PipelineResource
metadata:
name: github-repo
namespace: che
spec:
type: git
params:
- name: url
value: https://github.com/user/repo but then if the repo needs authentication it requires this: apiVersion: tekton.dev/v1alpha1
kind: TaskRun
metadata:
name: pipeline-test-auth
namespace: che
spec:
serviceAccountName: build-bot
taskRef:
name: read-task
inputs:
resources:
- name: github-repo
resourceRef:
name: github-repo
---
apiVersion: v1
kind: Secret
metadata:
name: basic-user-pass
namespace: che
annotations:
tekton.dev/git-0: https://github.com/user/repo
type: kubernetes.io/basic-auth
stringData:
username: username
password: pass #out in the open!!
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: build-bot
namespace: che
secrets:
- name: basic-user-pass |
to me these kind of secrets/config have to be enabled in Che #14680 |
A Tekton To author and manage Tekton resources, we have the vscode-tekton extension that is progressing well and it needs to be made available also on Che. Overall, we have a persistence problem with If you are using a devfile one thing that can make life easier is to keep your ./kube/config in the git repo and set the env |
che-dockerfiles/che-sidecar-tekton#2 is coming! and I can see "octant" in the docker file that's good. |
I have come with this as a temporary workaround for the kubeconfig persistence problem, also useful for bazel cache, and now gopls works so it can work for the go modules /.cache folder too |
the third part of your question I have been testing, not specifically for the projects folder but for the huge cache produced from bazel sidecar when referencing many external repos in /workspace file (http_archive refs): #!/bin/sh
kubectl delete -f ../tekton/task/bazel_build_gen.yaml -f ../tekton/task/taskrun.yml
kubectl delete -f bazelcache.yml
kubectl apply -f bazelcache.yml
kubectl apply -f ../tekton/task/bazel_build_gen.yaml
kubectl apply -f ../tekton/task/taskrun.yml
tkn taskrun logs pipeline-test-auth -f next to it in bazelcache.yaml: apiVersion: v1
kind: PersistentVolume
metadata:
name: bazelcache
labels:
type: local
spec:
storageClassName: bazelcache
capacity:
storage: 5Gi
accessModes:
- ReadWriteMany
hostPath:
path: "/data/wksp/workspaceax6ccroy58gxem8n/bazelcache/_bazel_user" #filled from sidecar, declared in bazel plugin yaml
---
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: bazelcache
annotations:
storageclass.kubernetes.io/is-default-class: "false"
provisioner: k8s.io/minikube-hostpath
reclaimPolicy: Retain The task that gets executed has ways to use input and output: apiVersion: tekton.dev/v1alpha1
kind: Task
metadata:
name: read-task
namespace: che
spec:
params:
- name: revision
description: 'el branch'
type: string
default: master
inputs:
resources:
- name: github-repo
type: git
workspaces:
- name: ghrepo
mountPath: /workspace
- name: bazelcache #this is created in bazel plugin meta.yaml
mountpath: /tekton/home/.cache/bazel/_bazel_1724 #this is because google's bazel runner doesn't assume rootless
steps:
- name: catreadme
image: 'launcher.gcr.io/google/bazel' #'gcr.io/cloud-builders/bazel:latest'
resources:
limits:
cpu: 2000m
memory: 1Gi
requests:
cpu: 500m
memory: 1Gi
script: |
#!/usr/bin/env bash
cd /workspace/github-repo
bazel run -- //:build_gen
- name: pushgo
image: 'launcher.gcr.io/google/bazel'
resources:
limits:
cpu: 5000m
memory: 2Gi
requests:
cpu: 200m
memory: 1Gi
script: |
cd /workspace/github-repo
rm -rf bazel-out/*
rm -rf bazel-bin/*
bazel build //whatever
cd bazel-bin/go
echo "module github.com/user/repo" > go.mod
git config --global user.email ""
git config --global user.name ""
git init .
git checkout -b v1alpha1 -f
git add .
git commit -am "-"
git remote add origin https://github.com/user/repo
git push -u --force origin v1alpha1 then the taskrun has to do some stuff around the volume, this is relevant to user id used in pipeline container too: apiVersion: tekton.dev/v1alpha1
kind: TaskRun
metadata:
name: pipeline-test-auth
namespace: che
spec:
params:
- name: revision
value: v1alpha1
serviceAccountName: build-bot
podTemplate:
securityContext:
runAsNonRoot: true
runAsUser: 1724
taskRef:
name: read-task
workspaces:
- name: ghrepo
emptyDir: {}
- name: bazelcache
volumeClaimTemplate:
spec:
accessModes:
- ReadWriteMany
volumeName: bazelcache
storageClassName: bazelcache
resources:
requests:
storage: 5Gi
inputs:
resources:
- name: github-repo
resourceRef:
name: github-repo THEN run the bash script after cding to build folder inside the tekton sidecar container shell. |
Issues go stale after Mark the issue as fresh with If this issue is safe to close now please do so. Moderators: Add |
/remove-lifecycle stale |
Issues go stale after Mark the issue as fresh with If this issue is safe to close now please do so. Moderators: Add |
Is your enhancement related to a problem? Please describe.
Here it is about how we could take advantage of the fact that
to perform builds as close as what we have in the CI but in the inner loop (before pushing to git).
Here would be the requirements:
The text was updated successfully, but these errors were encountered: