gazebo-tooling / gzdev

Gazebo developers tool is an Outreachy project designed to facilitate many of the usual tasks that Gazebo developers face daily
Other
14 stars 3 forks source link

Reproduce Jenkins builds locally #54

Open j-rivero opened 2 years ago

j-rivero commented 2 years ago

Steps that I usually run manually to reproduce jenkins:

debbuilder builds

  1. Download Dockerfile and build.sh (wget) from artifacts archived in the Jenkins run to reproduce
  2. chmod +x build.sh
  3. Docker build in the same way is being done in the build log (changing tag to test):

    docker build --build-arg GID=1001 --build-arg USERID=1001 --build-arg USER=jenkins --tag test .

  4. Docker run to go into the container

    docker run -i -t test /bin/bash

  5. Inside the container, some tweaks to deal with Jenkins paths (replace foo with debbuilder name):

    mkdir -p /home/jenkins/workspace/$foo-debbuilder/build

  6. Run build.sh (need to use bash):

    bash -x build.sh

    other builds Need to deal with git checkouts done in Jenkins that usually goes under: $WORKDIR/$software_name . The git checkouts are usually linked to input parameters in PARAMS such as sha1, DEST_BRANCH or similar.

i.e:/home/jenkins/workspace/ignition_gazebo-abichecker-any_to_any-ubuntu_auto-amd64/ign-gazebo

Looks like it is possible to run git init in $WORKDIR/$software_name and after that parse the build log for git commands starting with > at the beggining of the log and reproduce the actions of the plugin.

The recommended git tool is: NONE
No credentials specified
 > git rev-parse --resolve-git-dir /home/jenkins/workspace/ignition_gazebo-abichecker-any_to_any-ubuntu_auto-amd64/ign-gazebo/.git # timeout=10
Fetching changes from the remote Git repository
 > git config remote.origin.url https://github.com/gazebosim/gz-sim.git # timeout=10
Fetching upstream changes from https://github.com/gazebosim/gz-sim.git
 > git --version # timeout=10
 > git --version # 'git version 2.25.1'
 > git fetch --tags --force --progress -- https://github.com/gazebosim/gz-sim.git +refs/pull/*:refs/remotes/origin/pr/* +refs/heads/*:refs/remotes/origin/* # timeout=10
 > git rev-parse origin/main^{commit} # timeout=10
Checking out Revision a7071ec49d0c136fef8d3157409b9d33a8116999 (origin/main)
 > git config core.sparsecheckout # timeout=10
 > git checkout -f a7071ec49d0c136fef8d3157409b9d33a8116999 # timeout=10
Commit message: "Acoustic comms plugin (#1608)"