我有興趣在 Jenkins 中為我的 EKS 集群創建一個多分支專案。出于某種原因,當我單擊“新專案”時,我只能選擇創建一個自由式專案,并且我無法選擇多分支或任何其他選項,它們甚至不存在于該頁面上出于某種原因。
這是用于我的 EKS 集群的 jenkins.yaml 檔案,以防萬一它導致問題
apiVersion: v1
kind: ServiceAccount
metadata:
name: jenkins
namespace: default
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: jenkins
namespace: default
rules:
- apiGroups: [""]
resources: ["pods","services"]
verbs: ["create","delete","get","list","patch","update","watch"]
- apiGroups: ["apps"]
resources: ["deployments"]
verbs: ["create","delete","get","list","patch","update","watch"]
- apiGroups: [""]
resources: ["pods/exec"]
verbs: ["create","delete","get","list","patch","update","watch"]
- apiGroups: [""]
resources: ["pods/log"]
verbs: ["get","list","watch"]
- apiGroups: [""]
resources: ["secrets"]
verbs: ["get"]
- apiGroups: [""]
resources: ["persistentvolumeclaims"]
verbs: ["create","delete","get","list","patch","update","watch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: jenkins
namespace: default
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: jenkins
subjects:
- kind: ServiceAccount
name: jenkins
---
# Allows jenkins to create persistent volumes
# This cluster role binding allows anyone in the "manager" group to read secrets in any namespace.
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: jenkins-crb
subjects:
- kind: ServiceAccount
namespace: default
name: jenkins
roleRef:
kind: ClusterRole
name: jenkinsclusterrole
apiGroup: rbac.authorization.k8s.io
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
# "namespace" omitted since ClusterRoles are not namespaced
name: jenkinsclusterrole
rules:
- apiGroups: [""]
resources: ["persistentvolumes"]
verbs: ["create","delete","get","list","patch","update","watch"]
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: jenkins
namespace: default
spec:
selector:
matchLabels:
app: jenkins
replicas: 1
template:
metadata:
labels:
app: jenkins
spec:
containers:
- name: jenkins
image: jenkins/jenkins:lts
env:
- name: JAVA_OPTS
value: -Djenkins.install.runSetupWizard=false
ports:
- name: http-port
containerPort: 8080
- name: jnlp-port
containerPort: 50000
volumeMounts:
- name: jenkins-home
mountPath: /var
subPath: jenkins_home
- name: docker-sock-volume
mountPath: "/var/run/docker.sock"
imagePullPolicy: Always
volumes:
# This allows jenkins to use the docker daemon on the host, for running builds
# see https://stackoverflow.com/questions/27879713/is-it-ok-to-run-docker-from-inside-docker
- name: docker-sock-volume
hostPath:
path: /var/run/docker.sock
- name: jenkins-home
serviceAccountName: jenkins
---
apiVersion: v1
kind: Service
metadata:
name: jenkins
namespace: default
spec:
type: LoadBalancer
ports:
- name: ui
port: 8080
- name: jnlp
port: 50000
selector:
app: jenkins
---
uj5u.com熱心網友回復:
如果你有一個基本的 Jenkins 安裝(即:只是戰爭),那么你只會看到默認的“自由式作業”選項。為了擁有其他專案型別的選項,您必須安裝適當的插件。例如,如果你想用檔案夾來組織你的作業,那么你必須安裝檔案夾插件。您可能遇到的插件提供的所有附加功能也是如此。
初次啟動時,您會看到安裝推薦插件的選項。如果你跳過它,你也可以在之后這樣做。
就您而言,我相信您需要安裝Branch API plugin。這還將安裝所有必需的依賴項,包括核心 Pipeline (Workflow Aggregator) 插件、Pipeline: Multibranch插件和Pipeline: Job 插件。根據您的需要(即:步驟),您可能仍需要其他插件。
然后,您可以選擇創建其他作業型別:管道、多分支管道和組織檔案夾。
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/483622.html
標籤:詹金斯
