Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add profile specific jobs #409

Open
uhafner opened this issue Jul 4, 2024 · 4 comments
Open

Add profile specific jobs #409

uhafner opened this issue Jul 4, 2024 · 4 comments

Comments

@uhafner
Copy link

uhafner commented Jul 4, 2024

The current setup creates a running configuration of Jenkins with a specific agent, e.g. a maven agent. It would be also helpful, if the provided hello-world job would be profile dependent. I.e., when selecting the maven profile it should configure and build a maven project, and so on.

In my Jenkins student setup I am using such jobs for maven, see https://github.com/uhafner/codingstyle/tree/main/docker/images/jenkins-controller/preconfigured-jobs for more details.

Since I did not find an easy way to add profile specific jobs here, I created this issue rather than a PR. Once the general idea is possible, I can copy one of my projects of my codingstyle into this tutorial repository.

@gounthar
Copy link
Collaborator

gounthar commented Jul 8, 2024

Thanks a lot for this proposal, Ulli.
I'll have a look at your repo.

@gounthar
Copy link
Collaborator

gounthar commented Jul 8, 2024

Adding Jobs to the Controller Image

Current Setup

The jobs supplied with the current controller image are defined in the jobs subdirectory of the dockerfiles directory.

Potential for Expansion

Adding other jobs to the controller image is technically feasible and relatively straightforward.

Challenges and Considerations

The main challenge lies in tailoring the job list for each profile:

  • For Maven profiles, we would need to remove all non-Maven-related jobs
  • For Python profiles, we would need to remove all non-Python-related jobs
  • This pattern would continue for other profile types

Possible Solutions

We have two main approaches to consider:

  1. API-based Job Management:

    • Use the API at the start of the controller to adjust the job list
    • This method would involve removing irrelevant jobs for each profile
  2. Post-Start Job Addition:

    • Add specific jobs per profile after the Jenkins controller has started
    • This approach would involve adding only the relevant jobs for each profile

Both solutions have their merits and drawbacks, warranting further discussion and evaluation.

@uhafner
Copy link
Author

uhafner commented Jul 9, 2024

Wouldn't it be simpler if we would create for each profile that contains specific jobs another Docker compose service, that simply copies the specific job into a volume? And then the controller can copy these files into the job folder? Like the sidekick image is using the ssh folder? Or is this not possible in Docker?

@gounthar
Copy link
Collaborator

I have a PoC that works with the maven profile for the time being, but it's still failing with the python profile.
It's promising, though, and it uses the existing docker services.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants