Creating Jenkins VM

  1. Create file secret.tfvar:

    YA_TOKEN="<0Auth-Token>" 
    YA_CLOUD="<Yandex-Cloud-Name>"
    YA_FOLDER="<Yandex-Cloud-Folder-ID>"
    YA_SUBNET="<Yandex-Cloud-Subnet-ID>"
    YA_USER="<user-name>"
    YA_KEY_FOLDER="<some-folder>"
    
  2. Create VM with Jenkins using jenkins-vm.tf:

     terraform init
     terraform apply -var-file secret.tfvar -auto-approve
    

Setting up Jenkins

  1. Login into Jenkins using URL and password from terraform logs

  2. Install recommended plugins + Docker plugin + Docker Pipeline plugin

  3. Add ya-cloud-cred Jenkins creds with username oauth and yandex cloud token as a password

  4. Create Jenkins Pipeline with jenkins-pipelines/Jenkinsfile

  5. Approve signatures:

     method java.util.Properties load java.io.InputStream
     method org.jenkinsci.plugins.workflow.support.actions.EnvironmentAction getEnvironment
     new java.io.File java.lang.String
     new java.util.Properties
     staticMethod org.codehaus.groovy.runtime.DefaultGroovyMethods newDataInputStream java.io.File
    
  6. Run Pipeline