Skip to content

Commit

Permalink
Add jenkins e2e jobs
Browse files Browse the repository at this point in the history
Signed-off-by: Hang Yan <yhang@vmware.com>
  • Loading branch information
hangyan committed May 10, 2022
1 parent 34915e7 commit 04fb14c
Show file tree
Hide file tree
Showing 9 changed files with 1,016 additions and 0 deletions.
207 changes: 207 additions & 0 deletions ci/cluster-api/vsphere/templates/cluster.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,207 @@
apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
metadata:
labels:
cluster.x-k8s.io/cluster-name: CLUSTERNAME
name: CLUSTERNAME
namespace: CLUSTERNAMESPACE
spec:
clusterNetwork:
pods:
cidrBlocks:
- 192.168.0.0/16
controlPlaneRef:
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
kind: KubeadmControlPlane
name: CLUSTERNAME
infrastructureRef:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: VSphereCluster
name: CLUSTERNAME
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: VSphereCluster
metadata:
name: CLUSTERNAME
namespace: CLUSTERNAMESPACE
spec:
controlPlaneEndpoint:
host: CONTROLVIP
port: 6443
identityRef:
kind: Secret
name: CLUSTERNAME
server: VCENTERNAME
thumbprint: THUMBPRINTVALUE
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: VSphereMachineTemplate
metadata:
name: CLUSTERNAME
namespace: CLUSTERNAMESPACE
spec:
template:
spec:
cloneMode: linkedClone
datacenter: DATACENTERNAME
datastore: 208.1-20TB-NFS
diskGiB: 25
folder: CI
memoryMiB: 8192
network:
devices:
- dhcp4: true
networkName: NETWORKNAME
numCPUs: 4
resourcePool: RESOURCEPOOLPATH
server: VCENTERNAME
storagePolicyName: ""
template: OVATEMPLATENAME
thumbprint: THUMBPRINTVALUE
---
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
kind: KubeadmControlPlane
metadata:
name: CLUSTERNAME
namespace: CLUSTERNAMESPACE
spec:
kubeadmConfigSpec:
files:
- content: |
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
name: kube-vip
namespace: kube-system
spec:
containers:
- args:
- start
env:
- name: vip_arp
value: "true"
- name: vip_leaderelection
value: "true"
- name: vip_address
value: CONTROLVIP
- name: vip_interface
value: eth0
- name: vip_leaseduration
value: "15"
- name: vip_renewdeadline
value: "10"
- name: vip_retryperiod
value: "2"
image: ghcr.io/kube-vip/kube-vip:v0.3.5
imagePullPolicy: IfNotPresent
name: kube-vip
resources: {}
securityContext:
capabilities:
add:
- NET_ADMIN
- SYS_TIME
volumeMounts:
- mountPath: /etc/kubernetes/admin.conf
name: kubeconfig
hostNetwork: true
volumes:
- hostPath:
path: /etc/kubernetes/admin.conf
type: FileOrCreate
name: kubeconfig
status: {}
owner: root:root
path: /etc/kubernetes/manifests/kube-vip.yaml
initConfiguration:
nodeRegistration:
criSocket: /var/run/containerd/containerd.sock
name: '{{ ds.meta_data.hostname }}'
joinConfiguration:
nodeRegistration:
criSocket: /var/run/containerd/containerd.sock
name: '{{ ds.meta_data.hostname }}'
preKubeadmCommands:
- hostname "{{ ds.meta_data.hostname }}"
- echo "::1 ipv6-localhost ipv6-loopback" >/etc/hosts
- echo "127.0.0.1 localhost" >>/etc/hosts
- echo "127.0.0.1 {{ ds.meta_data.hostname }}" >>/etc/hosts
- echo "{{ ds.meta_data.hostname }}" >/etc/hostname
- ip link set eth0 mtu 1442
useExperimentalRetryJoin: true
users:
- name: capv
sshAuthorizedKeys:
- SSHAUTHORIZEDKEYS
sudo: ALL=(ALL) NOPASSWD:ALL
machineTemplate:
infrastructureRef:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: VSphereMachineTemplate
name: CLUSTERNAME
replicas: 1
version: K8SVERSION
---
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
kind: KubeadmConfigTemplate
metadata:
name: CLUSTERNAME-md-0
namespace: CLUSTERNAMESPACE
spec:
template:
spec:
joinConfiguration:
nodeRegistration:
criSocket: /var/run/containerd/containerd.sock
name: '{{ ds.meta_data.hostname }}'
preKubeadmCommands:
- hostname "{{ ds.meta_data.hostname }}"
- echo "::1 ipv6-localhost ipv6-loopback" >/etc/hosts
- echo "127.0.0.1 localhost" >>/etc/hosts
- echo "127.0.0.1 {{ ds.meta_data.hostname }}" >>/etc/hosts
- echo "{{ ds.meta_data.hostname }}" >/etc/hostname
- ip link set eth0 mtu 1442
users:
- name: capv
sshAuthorizedKeys:
- SSHAUTHORIZEDKEYS
sudo: ALL=(ALL) NOPASSWD:ALL
---
apiVersion: cluster.x-k8s.io/v1beta1
kind: MachineDeployment
metadata:
labels:
cluster.x-k8s.io/cluster-name: CLUSTERNAME
name: CLUSTERNAME-md-0
namespace: CLUSTERNAMESPACE
spec:
clusterName: CLUSTERNAME
replicas: 2
selector:
matchLabels: {}
template:
metadata:
labels:
cluster.x-k8s.io/cluster-name: CLUSTERNAME
spec:
bootstrap:
configRef:
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
kind: KubeadmConfigTemplate
name: CLUSTERNAME-md-0
clusterName: CLUSTERNAME
infrastructureRef:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: VSphereMachineTemplate
name: CLUSTERNAME
version: K8SVERSION
---
apiVersion: v1
kind: Secret
metadata:
name: CLUSTERNAME
namespace: CLUSTERNAMESPACE
stringData:
password: CLUSTERPASSWORD
username: CLUSTERUSERNAME
10 changes: 10 additions & 0 deletions ci/cluster-api/vsphere/templates/namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"apiVersion": "v1",
"kind": "Namespace",
"metadata": {
"name": "CLUSTERNAMESPACE",
"labels": {
"antrea-ci": "true"
}
}
}
1 change: 1 addition & 0 deletions ci/docker-registry
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
projects.registry.vmware.com
9 changes: 9 additions & 0 deletions ci/jenkins/jobs/defaults.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
- defaults:
name: global
ghpr_auth: fed5e5ac-afed-4af0-a299-d695edd3ec6f
theia_admin_list:
- hangyan
theia_org_list:
- vmware_tanzu
theia_white_list:
- '*'
48 changes: 48 additions & 0 deletions ci/jenkins/jobs/job-templates.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
- job-template:
name: '{name}-{test_name}-for-pull-request'
node: '{node}'
block-downstream: false
block-upstream: false
builders: '{builders}'
concurrent: false
description: '{description}'
project-type: freestyle
properties:
- build-discarder:
artifact-days-to-keep: -1
artifact-num-to-keep: -1
days-to-keep: 7
num-to-keep: 30
- github:
url: 'https://github.com/{org_repo}'
publishers: '{publishers}'
scm:
- git:
branches: '{branches}'
credentials-id: '{git_credentials_id}'
name: origin
refspec: +refs/heads/*:refs/remotes/origin/* +refs/pull/${{ghprbPullId}}/*:refs/remotes/origin/pr/${{ghprbPullId}}/*
url: 'https://github.com/{org_repo}'
wipe-workspace: true
triggers:
- github-pull-request:
admin-list: '{admin_list}'
allow-whitelist-orgs-as-admins: '{allow_whitelist_orgs_as_admins}'
auth-id: '{ghpr_auth}'
auto-close-on-fail: false
build-desc-template: null
github-hooks: true
only-trigger-phrase: '{only_trigger_phrase}'
org-list: '{org_list}'
permit-all: '{trigger_permit_all}'
trigger-phrase: '{trigger_phrase}'
white-list-target-branches: '{white_list_target_branches}'
white-list: '{white_list}'
status-context: '{status_context}'
status-url: '{status_url}'
success-status: '{success_status}'
failure-status: '{failure_status}'
error-status: '{error_status}'
triggered-status: '{triggered_status}'
started-status: '{started_status}'
wrappers: '{wrappers}'
9 changes: 9 additions & 0 deletions ci/jenkins/jobs/macros.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
- builder:
name: builder-e2e
builders:
- shell: |-
#!/usr/bin/env bash
set -ex
DOKCER_REGISTRY="$(head -n1 ci/docker-registry)"
chmod a+x ci/jenkins/test-vmc.sh
./ci/jenkins/test-vmc.sh --cluster-name "$BUILD_TAG" --registry "${DOCKER_REGISTRY}" --username "${CAPVC_USERNAME}" --password "${CAPVC_PASSWORD}" --testcase e2e
70 changes: 70 additions & 0 deletions ci/jenkins/jobs/projects.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
- project:
# ghpr_auth, antrea_admin_list, antrea_org_list and antrea_white_list
# should be defined as a global variable somewhere else
name: theia
git_credentials_id: THEIA_TEST_CRED
org_repo: hangyan/theia2
jobs:
- '{name}-{test_name}-for-pull-request':
test_name: e2e
node: 'antrea-test-node'
description: 'This is the {test_name} test for {name}.'
branches:
- ${{sha1}}
builders:
- builder-e2e
trigger_phrase: ^(?!Thanks for your PR).*/test-theia-(e2e|all).*
white_list_target_branches: []
allow_whitelist_orgs_as_admins: true
admin_list: '{theia_admin_list}'
org_list: '{theia_org_list}'
white_list: '{theia_white_list}'
only_trigger_phrase: true
trigger_permit_all: true
status_context: jenkins-e2e
status_url: --none--
success_status: Build finished.
failure_status: Failed. Add comment /test-theia-e2e to re-trigger.
error_status: Failed. Add comment /test-theia-e2e to re-trigger.
triggered_status: null
started_status: null
wrappers:
- credentials-binding:
- text:
credential-id: CODECOV_TOKEN # Jenkins secret that stores codecov token
variable: CODECOV_TOKEN
- timeout:
fail: true
timeout: 150
type: absolute
- credentials-binding:
- text:
credential-id: VMC_NETWORK_0
variable: VMC_NETWORK_0
- text:
credential-id: VMC_NETWORK_1
variable: VMC_NETWORK_1
- text:
credential-id: VCENTERNAME
variable: VCENTERNAME
- text:
credential-id: DATACENTERNAME
variable: DATACENTERNAME
- text:
credential-id: RESOURCEPOOLPATH
variable: RESOURCEPOOLPATH
- text:
credential-id: CAPVC_USERNAME
variable: CAPVC_USERNAME
- text:
credential-id: CAPVC_PASSWORD
variable: CAPVC_PASSWORD
publishers:
- archive:
allow-empty: true
artifacts: theia-test-logs.tar.gz, e2e-coverage.tar.gz
case-sensitive: true
default-excludes: true
fingerprint: false
only-if-success: false
admin_list: '{theia_admin_list}'
8 changes: 8 additions & 0 deletions ci/jenkins/ssh-config
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Host SSHCONFIGNODENAME
SendEnv LANG LC_*
HashKnownHosts yes
GSSAPIAuthentication yes
GSSAPIDelegateCredentials no
HostName SSHCONFIGNODEIP
Port 22
User capv
Loading

0 comments on commit 04fb14c

Please sign in to comment.