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

Enabled developer to input PR number for lsp4ij checkout input #1014

Open
wants to merge 18 commits into
base: main
Choose a base branch
from

Conversation

vaisakhkannan
Copy link
Contributor

@vaisakhkannan vaisakhkannan commented Oct 10, 2024

Fixes #998

Allowing developers to input the PR number for LSP4IJ checkout.

I made some slight changes to the artifact name setup, but there is no effect on previous scenarios. Additionally, I have now enabled specifying the LSP4IJ branch name, tag, PR number, or commit SHA based on the input provided by the developer.

@vaisakhkannan
Copy link
Contributor Author

vaisakhkannan commented Oct 10, 2024

If a developer want to check out LSP4IJ based on a PR number, then developer can check the box labeled “If you checked this, please make sure to enter only the LSP4IJ PR number below” and specify the PR number in the provided text field labeled “Reference/branch for LSP4IJ checkout.” Additionally, developer can specify the tag or branch of the liberty-tools-intellij repository to be used.


NOTE: Make sure to enable the checkbox labeled “Use lsp4ij locally” as well for this case.

Example run

Allow-developer-to-input-PR-number

@TrevCraw , Please suggest the changes in the wordings

@vaisakhkannan vaisakhkannan marked this pull request as draft October 10, 2024 12:08
@vaisakhkannan
Copy link
Contributor Author

Reference workflow runs :

https://github.com/vaisakhkannan/liberty-tools-intellij/actions/runs/11276704777 -- Normal push/PR builds
https://github.com/vaisakhkannan/liberty-tools-intellij/actions/runs/11276788312 -- Cron Job build

Manually running workflow examples

https://github.com/vaisakhkannan/liberty-tools-intellij/actions/runs/11276799815 ( developer entered PR number 411 and LTI version 24.0.9 --> merge commit sha value is not null, so no warning)

https://github.com/vaisakhkannan/liberty-tools-intellij/actions/runs/11276805354 ( developer entered PR number 500 and LTI version 24.0.9 --> merge commit sha value is null, so warning is present )

https://github.com/vaisakhkannan/liberty-tools-intellij/actions/runs/11276809742 -- LTI main & LSP4IJ main-- ( user entered branch name , main as an input for LSP4IJ checkout )

https://github.com/vaisakhkannan/liberty-tools-intellij/actions/runs/11276824366 -- ( user entered merge commit sha as an input for LSP4IJ checkout and LTI 24.0.9 )

https://github.com/vaisakhkannan/liberty-tools-intellij/actions/runs/11276832458 -- ( user entered LTI 24.0.9 and LSP4IJ main as an input for LSP4IJ checkout )

dessina-devasia
dessina-devasia previously approved these changes Nov 4, 2024
Copy link
Contributor

@dessina-devasia dessina-devasia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

.github/workflows/build.yaml Outdated Show resolved Hide resolved
.github/workflows/build.yaml Outdated Show resolved Hide resolved
docs/LSP4IJ-Continuous-Integration.md Outdated Show resolved Hide resolved

For example, if you want to trigger the Build Workflow from a branch of the LTI repository and build against LSP4IJ PR number `500` while using the `main` branch of LTI, you would configure it as follows:

<img alt="Example" height="300" src="images/Allow-developer-to-input-PR-number.png" width="300" style="display: block; margin: 0 auto;"/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update the image to show the new text.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the image with the same name

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You will need to update the other images in the doc where the inputs for running the build.yaml are shown. I think there are two other places in this doc. Check the other doc files as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TrevCraw, I updated the other images in the document and checked the other document files as well, but I couldn't find any images showing the inputs for running the build.yaml.

LSP4IJ_BRANCH: ${{ inputs.lsp4ijBranch }}
name: Fetch Commit ${{ inputs.refLsp4ij || '' }}
steps:
- name: Extract Merge Commit SHA
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have code in cronJob.yaml to extract the merge commit SHA. Is there any way that we can re-use that code somehow instead of re-doing it here?

Copy link
Contributor Author

@vaisakhkannan vaisakhkannan Nov 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TrevCraw , I tried investigating ways to reuse code from the cronJob.yaml file. We only require a specific portion of the code of the fetch_all_pull_request_shas job, and we do not need the complete job or the other three jobs. During my investigation, I found the following:

GitHub Actions does not support reusing a single job or some portion of a job from one workflow in another. Instead, we can achieve this by creating a new reusable workflow file that includes only the specific job(s) we want to reuse, but we can't create a common code for both the jobs that is, we use different values are being passed in the jobs, such as checkout_name in the fetch_merge_commit_sha_from_lsp4ij_PR job (from build.yaml) and is_empty in the fetch_all_pull_request_shas job. The pr_details variable is common to both jobs but has different values in each case.

If you think to use the code written in the 'Extract Merge Commit SHA' step in an additional workflow file, we should pass the values of ${{ env.REF_LSP4IJ }} and ${{ env.LSP4IJ_BRANCH }} as inputs to the new workflow file. Similarly, we need to get $pr_details and $checkout_name as outputs from the new workflow file, which will result in one additional build beyond the builds listed below.

Screenshot 2024-11-15 at 2 30 36 PM

Co-authored-by: Trevor Crawford <[email protected]>
@vaisakhkannan
Copy link
Contributor Author

vaisakhkannan commented Nov 15, 2024

I tested the changes today, You can check the build results below

https://github.com/OpenLiberty/liberty-tools-intellij/actions/runs/11853422736/job/33033521118?pr=1014 -- Normal push/PR builds
https://github.com/vaisakhkannan/liberty-tools-intellij/actions/runs/11853859331 -- Cron Job build

I can confirm that artifact names are working correct as expected.

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.

Allow developer to input PR number for lsp4ij checkout input
3 participants