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 a new option --shell-executor which would always ignore images and always run the shell executor #1447

Open
ecourreges-orange opened this issue Dec 3, 2024 · 1 comment

Comments

@ecourreges-orange
Copy link

Is your feature request related to a problem? Please describe.
I would like to run gitlab-ci-local from a devcontainer which already has everything needed to build my project and has the same dependencies as the different partial images used in different pipeline jobs.
To avoid adding a level of complexity with the docker executor which is used by default when there is either a job image or a default image, I would like to add the possibility to force the shell executor for the projects that I choose.

Similar topic from #1064 and #1314 but easier to implement.

Describe the solution you'd like
I would add an option --shell-executor to the command line which basically always sets imageName to null, I think it should be easy enough to code and should work, and I also hope it works with env conf so that I set it once and for all for each project where I need the option.

I am willing to provide the PR after discussion, once you are ok with the concept.

Describe alternatives you've considered
Loosing execution time and complexity by running the default docker executor

Additional context
From a devcontainer that contains a C++/Bazel or a Java/Maven build system, I want to be able to compile, docker build, deploy locally on minikube in iterations of less than 30s, so each second lost launching a docker is not acceptable.

Thanks for your time,
Regards.

@ecourreges-orange
Copy link
Author

It would almost just need to be this, adding if (this.argv.shellExecutor) return null; to the imageName function:

    private imageName (vars: {[key: string]: string} = {}): string | null {
         if (this.argv.shellExecutor) {
            return null;
        }
        const image = this.jobData["image"];
        if (!image) {
            if (this.argv.shellExecutorNoImage) {
                return null;
            } else {
                // https://docs.gitlab.com/ee/ci/runners/hosted_runners/linux.html#container-images
                return this.argv.defaultImage;
            }
        }
        const expanded = Utils.expandVariables(vars);
        const imageName = Utils.expandText(image.name, expanded);
        return imageName.includes(":") ? imageName : `${imageName}:latest`;
    }

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

1 participant