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 jenkins builds for pull requests #280

Merged
merged 10 commits into from
Dec 3, 2023
Merged

Conversation

ddelnano
Copy link
Collaborator

@ddelnano ddelnano commented Dec 1, 2023

Summary: Add jenkins builds for pull requests

This PR adds a Jenkinsfile that executes builds for all PRs. This partially completes #264.

The Jenkinsfile supports parameterizing the go version as well as the terraform versions to test against. At the moment, the test matrix (terraform versions) only supports Hashicorp's terraform. However, this can be extended to test against OpenTofu in the future.

The part of #264 that is missing is making the build status of a given commit and the logs available for the given PR. That will need additional investigation to complete. From my reading of the Jenkins GitHub branch source plugin and the GitHub commit status docs, it seems this must be accomplished through a GitHub app. These apps require callback URLs to setup authentication, so from my current research I believe it would require making Jenkins publicly available. That would probably be a non starter, but more investigation needs to be done and alternatives need to be considered.

Testing done: Verified that the build executed against two terraform versions. The build didn't pass but it was due to a flaky issue and is not a real failure.

screen

# Verify that the first build used v0.14.11 and second used v1.6.5
[root@jenkins-xoa ~]# ps auxww | grep terraform
jenkins   824996  0.0  1.1 764156 41640 ?        Sl   05:56   0:00 /tmp/plugintest-terraform59210296/terraform refresh -no-color -input=false -lock-timeout=0s -lock=true
jenkins   825003  0.0  1.3 764668 48596 ?        Sl   05:56   0:00 /tmp/plugintest-terraform59210296/terraform refresh -no-color -input=false -lock-timeout=0s -lock=true
root      825016  0.0  0.0  12144  1096 pts/0    S+   05:56   0:00 grep --color=auto terraform
[root@jenkins-xoa ~]# /tmp/plugintest-terraform59210296/terraform --version
Terraform v0.14.11


[root@jenkins-xoa ~]# ps auxww | grep terraform
jenkins   848814  0.0  1.6 1306828 60092 ?       Sl   06:25   0:00 /tmp/plugintest-terraform3788507395/terraform refresh -no-color -input=false -lock-timeout=0s -lock=true
root      848824  0.0  0.0  12144  1116 pts/0    S+   06:25   0:00 grep --color=auto terraform
[root@jenkins-xoa ~]# /tmp/plugintest-terraform3788507395/terraform --version
Terraform v1.6.5
on linux_amd64

@ddelnano ddelnano changed the title Add Jenkinsfile and test out builds from PRs Add Jenkinsfile for multibranch pipeline jenkins job Dec 3, 2023
@ddelnano ddelnano merged commit 6f9d08e into master Dec 3, 2023
@ddelnano ddelnano deleted the ddelnano/add-jenkins-file branch December 3, 2023 06:50
@ddelnano ddelnano changed the title Add Jenkinsfile for multibranch pipeline jenkins job Add jenkins builds for pull requests Dec 3, 2023
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.

1 participant