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.