Hey there,
As I mentioned, I have a Jenkins server deployed on a K8s. Two teams
are using the same C code repository. Team 1 is building the project with an Ubuntu remote agent, and Team 2 is using an ArchLinux (remote) environment. Team 1 is using the ”Jenkinsfile” to build the project on the Ubuntu machine, the machine right now is not accessible, but previous configuration of public keys was done to handle the ssh connection. Team 2 is using the ”Jenkinsfile2” to build the project on the ArchLinux machine, the same situation is happening (ssh public keys access, but machine right now is not accessible).
**Given I have only Jenkins username and password provided
Using above Jenkins service, implement the following:
- Create a docker image of Ubuntu agent
- Create a docker image of ArchLinux agent
- Configure above agents to be working on provided Jenkins instance
- Use the Ubuntu agent on the pipeline for Team 1 (to be build with Ubuntu container)
- Use the ArchLinux agent on the pipeline for Team 2 (to be build with ArchLinux container)
- Implement shared library to be able reuse common code whenever possible.
One of the Team’s Dockerfile looks like this -
pipeline {
agent any
stages {
stage('Build program') {
steps {
script {
sh """
ssh [email protected] "rm -rf ~/project"
ssh [email protected] "mkdir -p ~/project"
scp -r * [email protected]:~/project/
ssh [email protected] "cd ~/project/ && gcc src/program_team_1.c -o program_team_1"
"""
}
}
}
stage("Run program") {
steps {
script {
sh """
ssh [email protected] "~/project/program_team_1 | tee ~/project/program_team_1.log"
"""
}
}
}
}
}
Any suggestion/help would be much appreciated.