当我尝试在 Jenkins 中创建一个 'new item' 时,我只能选择创建一个自由式项目,没有其他选择
When I try to create a 'new item' in Jenkins, I only have the option to create a freestyle project and nothing else
我有兴趣在 Jenkins 中为我的 EKS 集群创建一个多分支项目。出于某种原因,当我单击 'new item' 时,我只能选择创建一个自由式项目,而我没有能力 select 多分支或任何其他选项,它们甚至不存在由于某种原因页面。
这是我的 jenkins.yaml 文件,用于我的 EKS 集群以防它导致问题
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
- 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
---
如果您有基本的 Jenkins 安装(即:只有 war),那么您只会看到默认的“自由式作业”选项。为了拥有额外项目类型的选项,您必须安装适当的插件。例如,如果你想用文件夹来组织你的工作,那么你必须安装 Folders plugin。您可能会遇到的插件提供的所有附加功能也是如此。
初次启动时,您会看到一个选项 install recommended plugins. If you skip that, you can do so 。
对于您的情况,我相信您需要安装 Branch API plugin. That will also install all the required dependencies, including the core Pipeline (Workflow Aggregator) plugin, Pipeline: Multibranch plugin and Pipeline: Job plugin。根据您的需要(即:步骤),您可能仍需要其他插件。
然后您将可以选择创建其他作业类型:管道、多分支管道和组织文件夹。
我有兴趣在 Jenkins 中为我的 EKS 集群创建一个多分支项目。出于某种原因,当我单击 'new item' 时,我只能选择创建一个自由式项目,而我没有能力 select 多分支或任何其他选项,它们甚至不存在由于某种原因页面。
这是我的 jenkins.yaml 文件,用于我的 EKS 集群以防它导致问题
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
- 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
---
如果您有基本的 Jenkins 安装(即:只有 war),那么您只会看到默认的“自由式作业”选项。为了拥有额外项目类型的选项,您必须安装适当的插件。例如,如果你想用文件夹来组织你的工作,那么你必须安装 Folders plugin。您可能会遇到的插件提供的所有附加功能也是如此。
初次启动时,您会看到一个选项 install recommended plugins. If you skip that, you can do so
对于您的情况,我相信您需要安装 Branch API plugin. That will also install all the required dependencies, including the core Pipeline (Workflow Aggregator) plugin, Pipeline: Multibranch plugin and Pipeline: Job plugin。根据您的需要(即:步骤),您可能仍需要其他插件。
然后您将可以选择创建其他作业类型:管道、多分支管道和组织文件夹。