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

Custom buildspec.yaml #6

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

dsouzajude
Copy link

Allow for the possibility of a freestyle custom buildspec.

This would allow the user to create a project with his/her own buildspec.yaml file which would therefore allow for more freedom and flexibility in their builds, but at the same time be compatible with the codebuilder agent to build the project via jnlp.

For example, the user might have the following buildspec.yaml file:

version: 0.2
phases:
  pre_build:
    commands:
      - which dockerd-entrypoint.sh >/dev/null && dockerd-entrypoint.sh || exit 0
  build:
    commands:
      - jenkins-agent -noreconnect -workDir "$CODEBUILD_SRC_DIR" -url "{{CODEBUILD_JENKINS_URL}}" "{{CODEBUILD_COMPUTER_JNLP_MAC}}" "{{CODEBUILD_NODE_DISPLAY_NAME}}"
      - exit 0

And what this PR does is simply replace the keywords {{CODEBUILD_JENKINS_URL}} {{CODEBUILD_COMPUTER_JNLP_MAC}} and {{CODEBUILD_NODE_DISPLAY_NAME}} with an override with the runtime values for the Codebuild jenkins URL, Computer JNLP MAC and Node's display name.

I got inspiration for this change when i needed to mount an NFS drive to cache maven dependencies and also be able to use Codebuild's own cache dir. More information on this use-case can be found here.

@carpnick
Copy link

This could be extended easily enough to solve for #10 and #5. This changes the source of truth to be the Codebuild project. instead of the plugin

This also allows us to start using native images out of Codebuild. We could conceivably add jenkins agent download/setup code in prebuild so we could use out of the box images from AWS.

I would like to see the plugin move in this direction.

@alexisde
Copy link

Do I understand correctly that this change will require the user to provide the buildspec.yml? IMHO this should be optional, if one is bundled then use that one otherwise the plugin will provide one.

@carpnick
Copy link

Do I understand correctly that this change will require the user to provide the buildspec.yml? IMHO this should be optional, if one is bundled then use that one otherwise the plugin will provide one.

As currently written, yes. The buildspec would be sourced from the Codebuild project instead of coming from Jenkins. I agree the change should be made in a backward compatible way.

@carpnick
Copy link

carpnick commented Nov 2, 2022

Do I understand correctly that this change will require the user to provide the buildspec.yml? IMHO this should be optional, if one is bundled then use that one otherwise the plugin will provide one.

@alexisde - Forked and created new plugin instead - https://github.com/jenkinsci/codebuild-cloud-plugin

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

Successfully merging this pull request may close these issues.

3 participants