Код IT Загрузка примера кода…

YAML main.yaml
jenkins:
  systemMessage: "Автоматизированный CI/CD сервер"
  numExecutors: 2
  scmCheckoutRetryCount: 3

securityRealm:
  local:
    allowsSignup: false
    users:
      - id: "admin"
        password: "${ADMIN_PASSWORD}"

authorizationStrategy:
  globalMatrix:
    permissions:
      - "Overall/Administer:admin"
      - "Job/Build:authenticated"
      - "Job/Read:anonymous"

nodes:
  - permanent:
      name: "linux-agent"
      remoteFS: "/home/jenkins"
      launcher:
        ssh:
          host: "192.168.1.10"
          port: 22
          credentialsId: "ssh-agent-key"

credentials:
  Система:
    domainCredentials:
      - credentials:
          - string:
              scope: GLOBAL
              id: "docker-hub-password"
              secret: "${DOCKER_HUB_PASSWORD}"
              description: "Пароль от Docker Hub"

jobs:
  - script: >
      pipelineJob('example-app') {
          definition {
              cpsScm {
                  scriptPath('Jenkinsfile')
                  scm {
                      git('https://github.com/user/repo.git', 'main')
                  }
              }
          }
      }
jenkins:
  systemMessage: "Автоматизированный CI/CD сервер"
  numExecutors: 2
  scmCheckoutRetryCount: 3

securityRealm:
  local:
    allowsSignup: false
    users:
      - id: "admin"
        password: "${ADMIN_PASSWORD}"

authorizationStrategy:
  globalMatrix:
    permissions:
      - "Overall/Administer:admin"
      - "Job/Build:authenticated"
      - "Job/Read:anonymous"

nodes:
  - permanent:
      name: "linux-agent"
      remoteFS: "/home/jenkins"
      launcher:
        ssh:
          host: "192.168.1.10"
          port: 22
          credentialsId: "ssh-agent-key"

credentials:
  Система:
    domainCredentials:
      - credentials:
          - string:
              scope: GLOBAL
              id: "docker-hub-password"
              secret: "${DOCKER_HUB_PASSWORD}"
              description: "Пароль от Docker Hub"

jobs:
  - script: >
      pipelineJob('example-app') {
          definition {
              cpsScm {
                  scriptPath('Jenkinsfile')
                  scm {
                      git('https://github.com/user/repo.git', 'main')
                  }
              }
          }
      }