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

Make Jenkins testing script runnable locally without Jenkins environment setup #237

Merged
merged 9 commits into from
Jan 7, 2019

Conversation

ehildenb
Copy link
Member

The script is organized slightly (so that parameters come at the top), and more notifications about build process are produced.

Also, the rv-match testing is done differently. Instead of cloning to subdirectory $WORKSPACE/k-pr, we're cloning directly to $WORKSPACE. K-Exercises tests are unaffected, but rv-match is now cloned to a subdirectory $WORKSPACE/rv-match, and we use manually update the K submodule inside RV-match to point directly at the HEAD of the checkout of K at $WORKSPACE. (so no more rm ... ; cp ... going on, just git ... operation).

@ehildenb ehildenb requested a review from dwightguth December 28, 2018 04:38
@ehildenb ehildenb changed the title Make Jenkins testing script runnable locallying without Jenkins environment setup Make Jenkins testing script runnable locally without Jenkins environment setup Dec 28, 2018
src/main/scripts/jenkins Outdated Show resolved Hide resolved
src/main/scripts/jenkins Outdated Show resolved Hide resolved

notif "CLEANING REPO"
mvn clean
git clean -dffx
Copy link
Collaborator

Choose a reason for hiding this comment

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

Also what does -ff do? Unless this option cleans submodules then this is still not going to work.

Copy link
Member Author

Choose a reason for hiding this comment

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

From man git clean:

       -f, --force
           If the Git configuration variable clean.requireForce is not set to false, git clean will
           refuse to delete files or directories unless given -f, -n or -i. Git will refuse to delete
           directories with .git sub directory or file unless a second -f is given.

Copy link
Member Author

Choose a reason for hiding this comment

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

So it makes sure that the rv-match and k-exercises repositories are actually deleted along with any other junk.

src/main/scripts/jenkins Outdated Show resolved Hide resolved
exit_status='0'
( cd k-exercises/tutorial
make -j"$NPROCS"
) || exit_status="$?"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Has this been tested in the case it fails? I ask because the last time you wrote something in approximately this syntax I had to change it because it didn't actually work.

Copy link
Member Author

Choose a reason for hiding this comment

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

[dev@arch-ehildenb k-pr]$ exit_status='0'
[dev@arch-ehildenb k-pr]$ echo "$exit_status"
0
[dev@arch-ehildenb k-pr]$ ( cd k-distribution/
> false
> ) || exit_status="$?"
[dev@arch-ehildenb k-pr]$ echo $exit_status
1
[dev@arch-ehildenb k-pr]$ 

The parenthesis spawn a sub-shell (so that any cd that happen don't get carried over past that part of the script). The semantics of $? is that the last command run (in sub-shell or otherwise) by the bash interpreter will be stored in $?. So if cd ... fails, then we'll get the exit_status set to the failure code of cd, and if cd succeeds and make fails, then exit_status will be whatever make returns.

git submodule update --init -- c-semantics k
cd k
git fetch ../../
git checkout FETCH_HEAD
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is this? I liked it better when we were just copying the directory into place. This feels error prone to me.

Copy link
Member Author

Choose a reason for hiding this comment

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

The reason to do this is because we want the rv-match tests to be runnable from directly in the K directory (without having to move to a temporary directory or work from one directory up like we were before).

The git fetch ../../ will fetch the current HEAD of the repository at ../../, which is the current checkout of K. git fetch with an anonymous remote (here ../../) updates FETCH_HEAD to whatever the remote HEAD is. Nothing too fancy here.

Benefits of this approach:

  • Jenkins script is directly runnable from the K repo directory (trying to use cp to do this would result in recursively copying the rv-match repo into itself).
  • We are sure that the rv-match submodule is updated to exactly the version of K that is being tested, because we fetch it directly.

@ehildenb ehildenb force-pushed the jenkins-script-rework branch from 89a71e1 to 12fa3e8 Compare January 5, 2019 21:03
@ehildenb
Copy link
Member Author

ehildenb commented Jan 5, 2019

Jenkins: test this please.

@dwightguth dwightguth merged commit 745bf3c into master Jan 7, 2019
@dwightguth dwightguth deleted the jenkins-script-rework branch January 7, 2019 14:40
Baltoli pushed a commit that referenced this pull request Apr 9, 2024
Fixes #237

---------

Co-authored-by: Sam Balco <goodlyrottenapple@gmail.com>
Co-authored-by: devops <devops@runtimeverification.com>
Baltoli pushed a commit that referenced this pull request Apr 9, 2024
Fixes #237

---------

Co-authored-by: Sam Balco <goodlyrottenapple@gmail.com>
Co-authored-by: devops <devops@runtimeverification.com>
Baltoli pushed a commit that referenced this pull request Apr 9, 2024
…yk#239)

Fixes #237

---------

Co-authored-by: Sam Balco <goodlyrottenapple@gmail.com>
Co-authored-by: devops <devops@runtimeverification.com>
Baltoli pushed a commit that referenced this pull request Apr 9, 2024
…yk#239)

Fixes #237

---------

Co-authored-by: Sam Balco <goodlyrottenapple@gmail.com>
Co-authored-by: devops <devops@runtimeverification.com>
Baltoli pushed a commit that referenced this pull request Apr 10, 2024
…yk#239)

Fixes #237

---------

Co-authored-by: Sam Balco <goodlyrottenapple@gmail.com>
Co-authored-by: devops <devops@runtimeverification.com>
Baltoli pushed a commit that referenced this pull request Apr 10, 2024
…yk#239)

Fixes #237

---------

Co-authored-by: Sam Balco <goodlyrottenapple@gmail.com>
Co-authored-by: devops <devops@runtimeverification.com>
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