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

Improve git repo and change detection logic #177

Conversation

SamTheisens
Copy link
Collaborator

@SamTheisens SamTheisens commented Aug 3, 2023

Attempts to make the change detection logic on a PR more robust.

  • Improve build status output, making it more instructive
  • Remove ad-hoc pull in "determine changes on branch", because it smells like voodoo cult. If the state of the branch is not the way it should be we should exit with a warning, not try to fix it and muddle on.
  • Allow for Jenkins to not be configured for scenarios in which another build tool is used
  • Allow for minimal clone scenarios in which the default branch is not present (Is it possible to checkout the whole history since the branch creation? actions/checkout#266 (comment))
  • Create repo command to optionally bring the branch into the required state for a PR

Also fixes a confusing problem in Jenkinsfile. The mpyl_config needs to be pulled from the Vandebron/mpyl_config repo. This created a branch called main in the local .git folder that pointed to a revision that doesn't exist in the Vandebron/mpyl repo. As a result we compare to a base that doesn't exist.
Now the file is curled in from via the github api instead of by checking out the repo.

@Jorg88, it looks like I can't edit the github actions in this repo anymore.
Suggesting to put this

New release `${{ steps.findPr.outputs.pr }}.${{ github.run_number }}` deployed at [Test Pypi](https://test.pypi.org/project/mpyl/). 
Install with `pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple mpyl==${{ steps.findPr.outputs.pr }}.${{ github.run_number }}`

at line 156 of .github/workflows/build-package.yml

Test scenario

  1. New branch gco -b feature/test-174

  2. mpyl build status:

    Branch not specified at build.versioning.branch in run_properties.yml. Branch determined via git: feature/test-174
    Branch: feature/test-174 at 96b6be3d121ff1651506da3d6330f7df13c7a959

  3. Make change to projects/service/src/sum.js

    Branch: feature/test-174 at 96b6be3d121ff1651506da3d6330f7df13c7a959
    Execution plan:
    🏗️ nodeservice
    📋 nodeservice
    🚀 nodeservice

  4. Commit change

    Branch: feature/test-174 at e9ff18931070de4803da2190274d5fccb0362824
    Execution plan:
    🏗️ nodeservice
    📋 nodeservice
    🚀 nodeservice

  5. Back to main branch

    1. Make change to sbtservice on main and commit.
    2. gco feature/test-174
    3. git merge main
      Branch: feature/test-174 at 9215d9c863c1fbf842de46bda189c92fa2226716
      Execution plan:
      🏗️ nodeservice
      📋 nodeservice
      🚀 nodeservice

⚠️ Could not find ticket corresponding to `feature/TECH-XXX-fix-change-detection-logic. Does your branch name follow the correct pattern?

@SamTheisens SamTheisens changed the title Test from fork Improve git repo and change detection logic Aug 3, 2023
SamTheisens and others added 20 commits August 3, 2023 14:52
because it's too implicit and should be done in advance if at all

branch:
e.g. `git clone --shallow-exclude main --single-branch --branch
feature/test-invalidation-logic
https://github.com/SamTheisens/mpyl-example-gha.git`

in which case there will be no default branch, but the first commit is
the base from which the branch was created

branch:
and not all refs, including tags

branch:
this should always be origin/main. If a local `main` is merged into the
current branch, that should not supersede the original base

branch:
to bring the branch into a state such that PRs can be built

branch:
branch: feature/TECH-490-migrate-mpyl-to-python-3.11
with basic implementation of status logic

branch:
@SamTheisens SamTheisens force-pushed the feature/TECH-XXX-fix-git-repo-issues branch from 84b6f58 to 0da4a76 Compare August 3, 2023 06:52
@SamTheisens SamTheisens closed this Aug 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.

2 participants