1

I provisioned a droplet with Jenkins/Docker/DDEV, the idea is to have Jenkins to run tests and provide a staging environment for multiple web projects. Each web project is already using DDEV to be used as a local dev environment. Ideally what I want to build is, having Jenkins pull from the repo, and start DDEV on the droplet, providing the staging environment.

So far, I have accomplished all of the above, however, I am a bit stack on the network configuration to allow people visiting my droplet through a web browser to access each Jenkins build.

Below is my Jenkinsfile so far, ideally if I could setup the network in the Jenkinsfile would be brilliant.

pipeline {
  agent any
  stages {
    stage('Checkout') {
      steps {
        checkout scmGit(branches: [[name: '*/main']], extensions: [], userRemoteConfigs: [[credentialsId: 'jenkinsSSH', url: 'https://myrepo.git']])
      }
    }

    stage('Example') {
      steps {
        echo "Running ${env.BUILD_ID} on ${env.JENKINS_URL}"
        sh 'cd $WORKSPACE && ddev start'
      }
    }
      
    stage('Release') {
      steps {
        echo 'Ready to release etc.'
      }
    }

  }
}

I had a look extensively in Google in case someone else has tried a similar endeavour. Also, looked if Jenkins has plugins for this task. I can't access the DDEV through the web browser.

Alimba
  • 113
  • 6

1 Answers1

1

If you want to access a running DDEV project via the web browser, you'll have to open it up with ddev config global --router-bind-all-ports, and then deal with handling name resolution. There are full details about this class of thing in https://ddev.readthedocs.io/en/latest/users/topics/sharing/; you may also be interested in the full sharing solution in https://ddev.readthedocs.io/en/latest/users/topics/hosting/

Also note that there is a GitHub action for this kind of testing that may help you, https://github.com/marketplace/actions/setup-ddev

rfay
  • 9,963
  • 1
  • 47
  • 89