【CI/CD】Rancher CD过程--20230906

这篇具有很好参考价值的文章主要介绍了【CI/CD】Rancher CD过程--20230906。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

gitlab设定CICD的变量

【CI/CD】Rancher CD过程--20230906,CICD,Git/GitLab/GitHub,ci/cd,rancher,kubernetes

  1. HARBOR_PASSWORD:密码
  2. HARBOR_USER:工号
  3. K8S_TOKEN:Bearer + rancher key
    【CI/CD】Rancher CD过程--20230906,CICD,Git/GitLab/GitHub,ci/cd,rancher,kubernetes
  4. K8S_WORKLOAD_URL:选择【View in API】的URL,并非workload的URL。
    如果是新版rancher,则使用/g回去旧版界面。
    【CI/CD】Rancher CD过程--20230906,CICD,Git/GitLab/GitHub,ci/cd,rancher,kubernetes
    【CI/CD】Rancher CD过程--20230906,CICD,Git/GitLab/GitHub,ci/cd,rancher,kubernetes

准备json.txt方法1(W公司SOP,但是可能失效)

  1. 选择workload,进入【View in API】
    【CI/CD】Rancher CD过程--20230906,CICD,Git/GitLab/GitHub,ci/cd,rancher,kubernetes

  2. right panel >> click edit
    【CI/CD】Rancher CD过程--20230906,CICD,Git/GitLab/GitHub,ci/cd,rancher,kubernetes

  3. Move to buttom , and click “Show Request”
    【CI/CD】Rancher CD过程--20230906,CICD,Git/GitLab/GitHub,ci/cd,rancher,kubernetes

  4. Copy the highlight area from “-d” parameter content
    【CI/CD】Rancher CD过程--20230906,CICD,Git/GitLab/GitHub,ci/cd,rancher,kubernetes

  5. Create json.txt file and paste the content
    【CI/CD】Rancher CD过程--20230906,CICD,Git/GitLab/GitHub,ci/cd,rancher,kubernetes

  6. 记得修改image tag和 “cattle.io/timestamp”: “CHANGEME”。

{
    "actions": {
        "pause": "https://rancher-wzsarm.wistron.com/v3/project/local:p-vhqv2/workloads/deployment:season:training-platform-django?action=pause",
        "redeploy": "https://rancher-wzsarm.wistron.com/v3/project/local:p-vhqv2/workloads/deployment:season:training-platform-django?action=redeploy",
        "resume": "https://rancher-wzsarm.wistron.com/v3/project/local:p-vhqv2/workloads/deployment:season:training-platform-django?action=resume",
        "rollback": "https://rancher-wzsarm.wistron.com/v3/project/local:p-vhqv2/workloads/deployment:season:training-platform-django?action=rollback"
    },
    "annotations": {
        "cattle.io/timestamp": "CHANGEME"
    },
    "baseType": "workload",
    "containers": [
        {
            "allowPrivilegeEscalation": false,
            "image": "harbor-k8s.wzs.wistron.com.cn/season/training_platform_django:0.0.8-build36",
            "imagePullPolicy": "IfNotPresent",
            "initContainer": false,
            "name": "training-platform-django",
            "ports": [
                {
                    "containerPort": 8000,
                    "dnsName": "training-platform-django-nodeport",
                    "hostPort": 0,
                    "kind": "NodePort",
                    "name": "8000tcl",
                    "protocol": "TCP",
                    "sourcePort": 0,
                    "type": "/v3/project/schemas/containerPort"
                }
            ],
            "privileged": false,
            "readOnly": false,
            "resources": {
                "limits": {
                    "cpu": "1",
                    "memory": "1000Mi"
                },
                "requests": {
                    "cpu": "1",
                    "memory": "1000Mi"
                },
                "type": "/v3/project/schemas/resourceRequirements"
            },
            "restartCount": 0,
            "runAsNonRoot": false,
            "stdin": true,
            "stdinOnce": false,
            "terminationMessagePath": "/dev/termination-log",
            "terminationMessagePolicy": "File",
            "tty": true,
            "type": "/v3/project/schemas/container"
        }
    ],
    "created": "2023-06-27T13:13:37Z",
    "createdTS": 1687871617000,
    "creatorId": null,
    "deploymentConfig": {
        "maxSurge": 1,
        "maxUnavailable": 0,
        "minReadySeconds": 0,
        "progressDeadlineSeconds": 600,
        "revisionHistoryLimit": 10,
        "strategy": "RollingUpdate"
    },
    "deploymentStatus": {
        "availableReplicas": 1,
        "conditions": [
            {
                "lastTransitionTime": "2023-06-27T13:13:37Z",
                "lastTransitionTimeTS": 1687871617000,
                "lastUpdateTime": "2023-08-24T05:46:46Z",
                "lastUpdateTimeTS": 1692856006000,
                "message": "ReplicaSet \"training-platform-django-5dc8b9dc9c\" has successfully progressed.",
                "reason": "NewReplicaSetAvailable",
                "status": "True",
                "type": "Progressing"
            },
            {
                "lastTransitionTime": "2023-09-05T09:48:01Z",
                "lastTransitionTimeTS": 1693907281000,
                "lastUpdateTime": "2023-09-05T09:48:01Z",
                "lastUpdateTimeTS": 1693907281000,
                "message": "Deployment has minimum availability.",
                "reason": "MinimumReplicasAvailable",
                "status": "True",
                "type": "Available"
            }
        ],
        "observedGeneration": 67,
        "readyReplicas": 1,
        "replicas": 1,
        "type": "/v3/project/schemas/deploymentStatus",
        "unavailableReplicas": 0,
        "updatedReplicas": 1
    },
    "dnsConfig": {
        "type": "/v3/project/schemas/podDNSConfig"
    },
    "dnsPolicy": "ClusterFirst",
    "hostIPC": false,
    "hostNetwork": false,
    "hostPID": false,
    "id": "deployment:season:training-platform-django",
    "labels": {
        "workload.user.cattle.io/workloadselector": "deployment-season-training-platform-django"
    },
    "links": {
        "remove": "https://rancher-wzsarm.wistron.com/v3/project/local:p-vhqv2/workloads/deployment:season:training-platform-django",
        "revisions": "https://rancher-wzsarm.wistron.com/v3/project/local:p-vhqv2/workloads/deployment:season:training-platform-django/revisions",
        "self": "https://rancher-wzsarm.wistron.com/v3/project/local:p-vhqv2/workloads/deployment:season:training-platform-django",
        "update": "https://rancher-wzsarm.wistron.com/v3/project/local:p-vhqv2/workloads/deployment:season:training-platform-django",
        "yaml": "https://rancher-wzsarm.wistron.com/v3/project/local:p-vhqv2/workloads/deployment:season:training-platform-django/yaml"
    },
    "name": "training-platform-django",
    "namespaceId": "season",
    "paused": false,
    "projectId": "local:p-vhqv2",
    "publicEndpoints": [
        {
            "addresses": [
                "10.41.241.111",
                "10.41.241.112",
                "10.41.241.113",
                "10.41.241.114",
                "10.41.241.115",
                "10.41.241.116"
            ],
            "allNodes": false,
            "hostname": "training-platform-django.k8sprd-wzs.k8s.wistron.com.cn",
            "ingressId": "season:training-platform-django-ingress",
            "nodeId": null,
            "podId": null,
            "port": 80,
            "protocol": "HTTP",
            "serviceId": "season:ingress-053ebdc075a82cf5efbe1ac16b822ab4"
        },
        {
            "addresses": [
                "10.41.241.111"
            ],
            "allNodes": true,
            "ingressId": null,
            "nodeId": null,
            "podId": null,
            "port": 30481,
            "protocol": "TCP",
            "serviceId": "season:training-platform-django-nodeport"
        }
    ],
    "restartPolicy": "Always",
    "scale": 1,
    "scheduling": {
        "scheduler": "default-scheduler"
    },
    "selector": {
        "matchLabels": {
            "workload.user.cattle.io/workloadselector": "deployment-season-training-platform-django"
        },
        "type": "/v3/project/schemas/labelSelector"
    },
    "state": "active",
    "terminationGracePeriodSeconds": 30,
    "transitioning": "no",
    "transitioningMessage": "",
    "type": "deployment",
    "uuid": "ab30eb79-f594-4de1-a615-b042b011b02f",
    "workloadAnnotations": {
        "deployment.kubernetes.io/revision": "12",
        "field.cattle.io/creatorId": "u-mp27e6gufb"
    },
    "workloadLabels": {
        "cattle.io/creator": "norman",
        "workload.user.cattle.io/workloadselector": "deployment-season-training-platform-django"
    }
}

准备json.txt方法2(Vincent Wen方法)

1.获取token
【CI/CD】Rancher CD过程--20230906,CICD,Git/GitLab/GitHub,ci/cd,rancher,kubernetes

输入curl -H "Authorization: Bearer token-jgch5:wvcrwwpglhk5jxz2fxt2h2jwmd2f7znjbjmzg5gwg4pnrc2qp5h5r9" -H "Content-Type:application/json" -X GET https://rancher-wzsarm.wistron.com/v3/project/local:p-vhqv2/workloads/deployment:season:training-platform-vue-dist

相当于是 curl -H "Authorization:${K8S_TOKEN}" -H "Content-Type:application/json" -X GET ${K8S_WORKLOAD_URL}
【CI/CD】Rancher CD过程--20230906,CICD,Git/GitLab/GitHub,ci/cd,rancher,kubernetes
2. 复制并写入json.txt中。

{
	"actions": {
		"pause": "https://rancher-wzsarm.wistron.com/v3/project/local:p-vhqv2/workloads/deployment:season:training-platform-vue-dist?action=pause",
		"redeploy": "https://rancher-wzsarm.wistron.com/v3/project/local:p-vhqv2/workloads/deployment:season:training-platform-vue-dist?action=redeploy",
		"resume": "https://rancher-wzsarm.wistron.com/v3/project/local:p-vhqv2/workloads/deployment:season:training-platform-vue-dist?action=resume",
		"rollback": "https://rancher-wzsarm.wistron.com/v3/project/local:p-vhqv2/workloads/deployment:season:training-platform-vue-dist?action=rollback"
	},
	"annotations": {
		"cattle.io/timestamp": "1693990188"
	},
	"baseType": "workload",
	"containers": [{
		"allowPrivilegeEscalation": false,
		"image": "harbor-k8s.wzs.wistron.com.cn/season/training_platform_vue_dist:0.0.0-build30",
		"imagePullPolicy": "IfNotPresent",
		"initContainer": false,
		"name": "training-platform-vue-dist",
		"ports": [{
			"containerPort": 8080,
			"dnsName": "training-platform-vue-dist-nodeport",
			"hostPort": 0,
			"kind": "NodePort",
			"name": "8080tcl",
			"protocol": "TCP",
			"sourcePort": 0,
			"type": "/v3/project/schemas/containerPort"
		}],
		"privileged": false,
		"readOnly": false,
		"resources": {
			"limits": {
				"cpu": "300m",
				"memory": "300Mi"
			},
			"type": "/v3/project/schemas/resourceRequirements"
		},
		"restartCount": 0,
		"runAsNonRoot": false,
		"stdin": true,
		"stdinOnce": false,
		"terminationMessagePath": "/dev/termination-log",
		"terminationMessagePolicy": "File",
		"tty": true,
		"type": "/v3/project/schemas/container"
	}],
	"created": "2023-06-27T14:18:09Z",
	"createdTS": 1687875489000,
	"creatorId": null,
	"deploymentConfig": {
		"maxSurge": 1,
		"maxUnavailable": 0,
		"minReadySeconds": 0,
		"progressDeadlineSeconds": 600,
		"revisionHistoryLimit": 10,
		"strategy": "RollingUpdate"
	},
	"deploymentStatus": {
		"availableReplicas": 1,
		"conditions": [{
			"lastTransitionTime": "2023-09-07T02:04:59Z",
			"lastTransitionTimeTS": 1694052299000,
			"lastUpdateTime": "2023-09-07T02:04:59Z",
			"lastUpdateTimeTS": 1694052299000,
			"message": "ReplicaSet \"training-platform-vue-dist-7db7c6498f\" has successfully progressed.",
			"reason": "NewReplicaSetAvailable",
			"status": "True",
			"type": "Progressing"
		}, {
			"lastTransitionTime": "2023-09-07T02:05:23Z",
			"lastTransitionTimeTS": 1694052323000,
			"lastUpdateTime": "2023-09-07T02:05:23Z",
			"lastUpdateTimeTS": 1694052323000,
			"message": "Deployment has minimum availability.",
			"reason": "MinimumReplicasAvailable",
			"status": "True",
			"type": "Available"
		}],
		"observedGeneration": 74,
		"readyReplicas": 1,
		"replicas": 1,
		"type": "/v3/project/schemas/deploymentStatus",
		"unavailableReplicas": 0,
		"updatedReplicas": 1
	},
	"dnsPolicy": "ClusterFirst",
	"hostIPC": false,
	"hostNetwork": false,
	"hostPID": false,
	"id": "deployment:season:training-platform-vue-dist",
	"labels": {
		"workload.user.cattle.io/workloadselector": "deployment-season-training-platform-vue-dist"
	},
	"links": {
		"remove": "https://rancher-wzsarm.wistron.com/v3/project/local:p-vhqv2/workloads/deployment:season:training-platform-vue-dist",
		"revisions": "https://rancher-wzsarm.wistron.com/v3/project/local:p-vhqv2/workloads/deployment:season:training-platform-vue-dist/revisions",
		"self": "https://rancher-wzsarm.wistron.com/v3/project/local:p-vhqv2/workloads/deployment:season:training-platform-vue-dist",
		"update": "https://rancher-wzsarm.wistron.com/v3/project/local:p-vhqv2/workloads/deployment:season:training-platform-vue-dist",
		"yaml": "https://rancher-wzsarm.wistron.com/v3/project/local:p-vhqv2/workloads/deployment:season:training-platform-vue-dist/yaml"
	},
	"name": "training-platform-vue-dist",
	"namespaceId": "season",
	"paused": false,
	"projectId": "local:p-vhqv2",
	"publicEndpoints": [{
		"addresses": ["10.41.241.111", "10.41.241.112", "10.41.241.113", "10.41.241.114", "10.41.241.115", "10.41.241.116"],
		"allNodes": false,
		"hostname": "training-platform.k8sprd-wzs.k8s.wistron.com.cn",
		"ingressId": "season:training-platform-vue-dist-ingress",
		"nodeId": null,
		"podId": null,
		"port": 80,
		"protocol": "HTTP",
		"serviceId": "season:ingress-9932efa3ab00c77c4cfb44b758c758b2"
	}, {
		"addresses": ["10.41.241.111"],
		"allNodes": true,
		"ingressId": null,
		"nodeId": null,
		"podId": null,
		"port": 30396,
		"protocol": "TCP",
		"serviceId": "season:training-platform-vue-dist-nodeport"
	}],
	"restartPolicy": "Always",
	"scale": 1,
	"scheduling": {
		"scheduler": "default-scheduler"
	},
	"selector": {
		"matchLabels": {
			"workload.user.cattle.io/workloadselector": "deployment-season-training-platform-vue-dist"
		},
		"type": "/v3/project/schemas/labelSelector"
	},
	"state": "active",
	"terminationGracePeriodSeconds": 30,
	"transitioning": "no",
	"transitioningMessage": "",
	"type": "deployment",
	"uuid": "d63402fa-b097-4f01-9a6e-1db4e2b87912",
	"workloadAnnotations": {
		"deployment.kubernetes.io/revision": "21",
		"field.cattle.io/creatorId": "u-mp27e6gufb"
	},
	"workloadLabels": {
		"cattle.io/creator": "norman",
		"workload.user.cattle.io/workloadselector": "deployment-season-training-platform-vue-dist"
	}
}
  1. 记得修改json.txt中image tag和 “cattle.io/timestamp”: “CHANGEME”。
{
	"actions": {
		"pause": "https://rancher-wzsarm.wistron.com/v3/project/local:p-vhqv2/workloads/deployment:season:training-platform-vue-dist?action=pause",
		"redeploy": "https://rancher-wzsarm.wistron.com/v3/project/local:p-vhqv2/workloads/deployment:season:training-platform-vue-dist?action=redeploy",
		"resume": "https://rancher-wzsarm.wistron.com/v3/project/local:p-vhqv2/workloads/deployment:season:training-platform-vue-dist?action=resume",
		"rollback": "https://rancher-wzsarm.wistron.com/v3/project/local:p-vhqv2/workloads/deployment:season:training-platform-vue-dist?action=rollback"
	},
	"annotations": {
		"cattle.io/timestamp": "CHANGEME"
	},
	"baseType": "workload",
	"containers": [{
		"allowPrivilegeEscalation": false,
		"image": "harbor-k8s.wzs.wistron.com.cn/season/training_platform_vue_dist:0.0.0-buildCI_PIPELINE_IID", #(image需要修订版本号)
		"imagePullPolicy": "IfNotPresent",
		"initContainer": false,
		"name": "training-platform-vue-dist",
		"ports": [{
			"containerPort": 8080,
			"dnsName": "training-platform-vue-dist-nodeport",
			"hostPort": 0,
			"kind": "NodePort",
			"name": "8080tcl",
			"protocol": "TCP",
			"sourcePort": 0,
			"type": "/v3/project/schemas/containerPort"
		}],
		"privileged": false,
		"readOnly": false,
		"resources": {
			"limits": {
				"cpu": "300m",
				"memory": "300Mi"
			},
			"type": "/v3/project/schemas/resourceRequirements"
		},
		"restartCount": 0,
		"runAsNonRoot": false,
		"stdin": true,
		"stdinOnce": false,
		"terminationMessagePath": "/dev/termination-log",
		"terminationMessagePolicy": "File",
		"tty": true,
		"type": "/v3/project/schemas/container"
	}],
	"created": "2023-06-27T14:18:09Z",
	"createdTS": 1687875489000,
	"creatorId": null,
	"deploymentConfig": {
		"maxSurge": 1,
		"maxUnavailable": 0,
		"minReadySeconds": 0,
		"progressDeadlineSeconds": 600,
		"revisionHistoryLimit": 10,
		"strategy": "RollingUpdate"
	},
	"deploymentStatus": {
		"availableReplicas": 1,
		"conditions": [{
			"lastTransitionTime": "2023-09-07T02:04:59Z",
			"lastTransitionTimeTS": 1694052299000,
			"lastUpdateTime": "2023-09-07T02:04:59Z",
			"lastUpdateTimeTS": 1694052299000,
			"message": "ReplicaSet \"training-platform-vue-dist-7db7c6498f\" has successfully progressed.",
			"reason": "NewReplicaSetAvailable",
			"status": "True",
			"type": "Progressing"
		}, {
			"lastTransitionTime": "2023-09-07T02:05:23Z",
			"lastTransitionTimeTS": 1694052323000,
			"lastUpdateTime": "2023-09-07T02:05:23Z",
			"lastUpdateTimeTS": 1694052323000,
			"message": "Deployment has minimum availability.",
			"reason": "MinimumReplicasAvailable",
			"status": "True",
			"type": "Available"
		}],
		"observedGeneration": 74,
		"readyReplicas": 1,
		"replicas": 1,
		"type": "/v3/project/schemas/deploymentStatus",
		"unavailableReplicas": 0,
		"updatedReplicas": 1
	},
	"dnsPolicy": "ClusterFirst",
	"hostIPC": false,
	"hostNetwork": false,
	"hostPID": false,
	"id": "deployment:season:training-platform-vue-dist",
	"labels": {
		"workload.user.cattle.io/workloadselector": "deployment-season-training-platform-vue-dist"
	},
	"links": {
		"remove": "https://rancher-wzsarm.wistron.com/v3/project/local:p-vhqv2/workloads/deployment:season:training-platform-vue-dist",
		"revisions": "https://rancher-wzsarm.wistron.com/v3/project/local:p-vhqv2/workloads/deployment:season:training-platform-vue-dist/revisions",
		"self": "https://rancher-wzsarm.wistron.com/v3/project/local:p-vhqv2/workloads/deployment:season:training-platform-vue-dist",
		"update": "https://rancher-wzsarm.wistron.com/v3/project/local:p-vhqv2/workloads/deployment:season:training-platform-vue-dist",
		"yaml": "https://rancher-wzsarm.wistron.com/v3/project/local:p-vhqv2/workloads/deployment:season:training-platform-vue-dist/yaml"
	},
	"name": "training-platform-vue-dist",
	"namespaceId": "season",
	"paused": false,
	"projectId": "local:p-vhqv2",
	"publicEndpoints": [{
		"addresses": ["10.41.241.111", "10.41.241.112", "10.41.241.113", "10.41.241.114", "10.41.241.115", "10.41.241.116"],
		"allNodes": false,
		"hostname": "training-platform.k8sprd-wzs.k8s.wistron.com.cn",
		"ingressId": "season:training-platform-vue-dist-ingress",
		"nodeId": null,
		"podId": null,
		"port": 80,
		"protocol": "HTTP",
		"serviceId": "season:ingress-9932efa3ab00c77c4cfb44b758c758b2"
	}, {
		"addresses": ["10.41.241.111"],
		"allNodes": true,
		"ingressId": null,
		"nodeId": null,
		"podId": null,
		"port": 30396,
		"protocol": "TCP",
		"serviceId": "season:training-platform-vue-dist-nodeport"
	}],
	"restartPolicy": "Always",
	"scale": 1,
	"scheduling": {
		"scheduler": "default-scheduler"
	},
	"selector": {
		"matchLabels": {
			"workload.user.cattle.io/workloadselector": "deployment-season-training-platform-vue-dist"
		},
		"type": "/v3/project/schemas/labelSelector"
	},
	"state": "active",
	"terminationGracePeriodSeconds": 30,
	"transitioning": "no",
	"transitioningMessage": "",
	"type": "deployment",
	"uuid": "d63402fa-b097-4f01-9a6e-1db4e2b87912",
	"workloadAnnotations": {
		"deployment.kubernetes.io/revision": "21",
		"field.cattle.io/creatorId": "u-mp27e6gufb"
	},
	"workloadLabels": {
		"cattle.io/creator": "norman",
		"workload.user.cattle.io/workloadselector": "deployment-season-training-platform-vue-dist"
	}
}

修改.gitlab-ci.yml

format

update:
  stage: deploy
  image: harbor.wistron.com/base_image/alpine:3.10
  before_script:
    - apk add curl
    - export CI_JOB_TIMESTAMP=$(date +"%s")
  tags:
    - prd-runner02  # select your runner
  script:
    - MOVE TO YOUR JSON.TXT PATH
    - sed -i s/CHANGEME/$CI_JOB_TIMESTAMP/g json.txt
    - sed -i s/CI_PIPELINE_IID/$CI_PIPELINE_IID/g json.txt
    - curl -H "Authorization:${K8S_TOKEN}" -H "Content-Type:application/json" -d "@json.txt" -X PUT ${K8S_WORKLOAD_URL}

我的代码.gitlab-ci.yml

variables:
  DOCKER_IMAGE_NAME: training_platform_django
  DOCKER_IMAGE_TAG: 0.0.8

 
  
services:
  - name: harbor-k8s.wzs.wistron.com.cn/base_image/docker:stable
    entrypoint: []
    command: ["--insecure-registry=harbor-k8s.wistron.com.cn"]

stages:
  - docker_build
  - docker-update

docker-build:
  image: harbor-k8s.wzs.wistron.com.cn/base_image/docker:stable
  stage: docker_build
  tags: 
    - wzs-runner01
  script:
    - docker info
    - echo $DOCKER_IMAGE_NAME
    - echo $DOCKER_IMAGE_TAG
    - docker build -t $DOCKER_IMAGE_NAME:$DOCKER_IMAGE_TAG .
    - docker tag $DOCKER_IMAGE_NAME:$DOCKER_IMAGE_TAG harbor-k8s.wzs.wistron.com.cn/season/$DOCKER_IMAGE_NAME:$DOCKER_IMAGE_TAG-build$CI_PIPELINE_IID
    - echo "$HARBOR_PASSWORD" | docker login -u "$HARBOR_USER"  --password "$HARBOR_PASSWORD" harbor-k8s.wzs.wistron.com.cn
    - docker push harbor-k8s.wzs.wistron.com.cn/season/$DOCKER_IMAGE_NAME:$DOCKER_IMAGE_TAG-build$CI_PIPELINE_IID



docker-update:
  stage: docker-update
  image: harbor.wistron.com/base_image/alpine:3.10
  before_script:
    - apk add curl
    - export CI_JOB_TIMESTAMP=$(date +"%s")
  tags:
    - wzs-runner01
  script:
    - sed -i s/CHANGEME/$CI_JOB_TIMESTAMP/g json.txt
    - sed -i s/CI_PIPELINE_IID/$CI_PIPELINE_IID/g json.txt
    - curl -H "Authorization:${K8S_TOKEN}" -H "Content-Type:application/json" -d "@json.txt" -X PUT ${K8S_WORKLOAD_URL}

gitlab pipeline

显示成功
【CI/CD】Rancher CD过程--20230906,CICD,Git/GitLab/GitHub,ci/cd,rancher,kubernetes
自动更新
【CI/CD】Rancher CD过程--20230906,CICD,Git/GitLab/GitHub,ci/cd,rancher,kubernetes
【CI/CD】Rancher CD过程--20230906,CICD,Git/GitLab/GitHub,ci/cd,rancher,kubernetes文章来源地址https://www.toymoban.com/news/detail-697422.html

到了这里,关于【CI/CD】Rancher CD过程--20230906的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • gitlab CI/CD 安装 gitlab runner

    一、为什么需要安装gitlab runner ? 极狐GitLab Runner 是在流水线中运行作业的应用,与极狐GitLab CI/CD 配合运作。 说白了就是你部署的一个agent。 二、如何安装? 1.介绍通过helm部署github runner 2.helm添加仓库 helm repo add gitlab https://charts.gitlab.io 3.拉取chars helm pull gitlab/gitlab-runner -- 拉

    2024年02月14日
    浏览(62)
  • Rancher2.7 + Jenkins CI/CD全流程保姆级最佳实践

    CI方面,官方推荐的视频教程等多是使用极狐Gitlab CI,但社区版极狐每月仅400分钟构造时间,额外购买价格为1000分钟/68元,而私有化部署极狐Gitlab对比部署使用Jenkins,具有更高的成本、更狭窄的适用面,且如果个人使用其代码仓库功能,并不比Gitee可靠。 Gitee 同样提供CI服务

    2024年02月05日
    浏览(76)
  • 纯手工搭建 GitaLab与Gitlab-CI/CD--附 gitlab-ci.yml示例

    作者:javastarboy 背景:前几年(2018 年前后)的 jenkins+docker+k8s 的CI/CD 在工作之中受益不少。提升了不少工作效率。而随着这几年的使用发现,目前 gitlab-CI/CD 在持续集成部署中更加方便、高效。 尤其是在测试环节中,研发无需编写复杂的 jenkins 脚本,只要提交代码,即可自动

    2023年04月08日
    浏览(49)
  • GitLab Runner 实现项目 CI/CD 发布

    Gitlab实现CICD的方式有很多,比如通过Jenkins,通过Gitlab Runner等,今天主要介绍后者。Gitlab在安装的时候,就默认包含了Gitlab CI的能力,但是该能力只是用于协调作业,并不能真的去执行作业,因此需要搭配Gitlab Runner来作为执行器实现具体的CICD工作。Gitlab Runner可以被安装在任

    2024年01月17日
    浏览(60)
  • DevOps系列文章之 GitLab CI/CD

    由于目前公司使用的gitlab,大部分项目使用的CICD是gitlab的CICD,少部分用的是jenkins,使用了gitlab-ci一段时间后感觉还不错,因此总结一下 介绍gitlab的CICD之前,可以先了解CICD是什么 我们的开发模式经历了如下的转变:瀑布模型-敏捷开发→DevOps(Development、Operations的组合词,是

    2024年01月22日
    浏览(53)
  • 使用gitlab 自带 CI/CD 构建部署项目

    这里我用的是桥接模式 桥接模式方便局域网内的小伙伴一起使用 如果没有这个打算可跳过这步 编辑网络 vi /etc/sysconfig/network-scripts/ifcfg-你的网络名称 修改如下内容 这里我有句话要讲, 这些信息配置完成后出现\\\"网络不可达\\\" 需要把 BOOTPROTO 改为 dhcp 详情可参考 处理网络不可达

    2024年02月12日
    浏览(59)
  • Gitlab CI/CD: rules和only

    rules 和 only 都是在 GitLab CI/CD 配置中用于控制作业(job)何时执行的,但它们之间有一些不同之处: only : only 用于定义在特定情况下触发作业的条件。你可以指定一系列触发条件,只有当至少一个条件匹配时,作业才会被触发执行。 only 通常用于根据分

    2024年02月03日
    浏览(64)
  • CI/CD:GitLab-CI 自动化集成/部署 JAVA微服务的应用合集

    日常开发中,每次代码编写完成后,都需要手动打包,并且上传服务器,无论本地打包的时间或者上传文件到服务器都需要花费大量的时间来完成,都是重复的并且毫无意义,应该将时间花费在更有价值的时间上;所以编写这篇文章,将自己收集、搭建、测试的步骤或经验汇

    2024年02月08日
    浏览(48)
  • 【基于 GitLab 的 CI/CD 实践】03、GitLab Pipeline 实践(上)

    目录 一、GitLab Pipeline 流水线语法有哪些?流水线参数列表 如何检查语法错误?流水线语法检测 二、Pipeline 基础语法 job script before_script after_script stages 未定义 stages ​定义 stages 控制 stage 运行顺序   .pre .post stage variables 综合实例(一) tags allow_failure when manual 手动 delayed 延迟

    2024年02月17日
    浏览(59)
  • gitlab+jenkins+harbor实现CI/CD(2)——初级

    git安装 jenkins主机上安装docker-ce 配置仓库证书 测试 创建项目 创建一个freestyle project 在jenkins主机获取密钥 在gitlab上传公钥 在jenkins上传私钥 输入测试命令后保存 点击立即构建 查看控制台输出 工作路径 构建触发器,定时触发 安装插件 gitlab和 Cloudbee docker 配置gitlab 在网络设

    2024年02月09日
    浏览(50)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包