Jenkins Pipeline

Jenkins Pipeline

  1. Jenkins

Jenkins

pipeline {
    agent any

    stages {
        stage('github clone') {
            steps {
                git branch: 'main', url: 'https://github.com/pushdown99/jenkins-hello-world.git'
            }
        }
    }
}
kubectl get pod -n jenkins

NAME                       READY   STATUS    RESTARTS   AGE
jenkins-7c6f896bf4-h44rq   1/1     Running   0          18m
kubectl -n jenkins exec -it jenkins-7c6f896bf4-h44rq -- /bin/bash

jenkins@jenkins-7c6f896bf4-h44rq:/$
jenkins@jenkins-7c6f896bf4-h44rq:~$ cd workspace
jenkins@jenkins-7c6f896bf4-h44rq:~/workspace$ cd hello-world
jenkins@jenkins-7c6f896bf4-h44rq:~/workspace/hello-world$ ls

Jenkinsfile  README.md
FROM jenkins/jenkins:lts
USER root
RUN apt-get update
RUN apt-get install -y build-essential sudo net-tools iputils-ping
RUN echo 'root:Docker!' | chpasswd
pipeline {
    agent { docker { image 'node:22.13.0-alpine3.21' } }
    stages {
        stage('build') {
            steps {
                sh 'node --version'
            }
        }
    }
}

© 2018. All rights reserved.

Powered by Hydejack v8.4.0