Skip to content

Adjust Vagrant portability testing for automated build #27081

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

Draft
wants to merge 23 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
120edf9
Switch from freebsd official to bento boxes
arifthpe Apr 9, 2025
406bf2f
Add and use proxy-setup.sh provision script
arifthpe Apr 9, 2025
1d73aea
Update versions of FreeBSD being tested
arifthpe Apr 9, 2025
64f676d
Switch to expecting lowercase http[s]_proxy vars
arifthpe Apr 9, 2025
bf6cb42
Also pass through lowercase proxy vars to provision script
arifthpe Apr 9, 2025
9d97e6f
Update dir names to match box names
arifthpe Apr 10, 2025
0ebe013
Use 4 threads for make
arifthpe Apr 30, 2025
404e320
Clone this branch when testing
arifthpe May 1, 2025
9126a13
Run commands on a single VM by default
arifthpe May 15, 2025
464e2b8
Emit non-zero exit code on command failure
arifthpe May 15, 2025
1162ac1
Try mirror_type none
arifthpe May 15, 2025
026a8b3
Give each current VM 2 CPUs
arifthpe May 15, 2025
83001b1
Split repo adjustment step into separate provision script
arifthpe May 15, 2025
c724d2b
Limit ubuntu-jammy64-homebrew to 4G mem like others
arifthpe May 15, 2025
f9ae0c9
Use nproc instead of hardcoded 4 threads for build
arifthpe May 15, 2025
76873c0
Fix DNS nameservers for debian box
arifthpe May 16, 2025
a9dbf7a
Reduce memory of each VM to 2gb
arifthpe May 19, 2025
923637b
Merge branch 'main' into vagrant-automation
arifthpe Jun 30, 2025
02375b2
Use MAKEJ var rather than nproc make jobs
arifthpe Jun 30, 2025
139e983
Fix paths in running other provision scripts
arifthpe Jun 30, 2025
53d6259
Use MAKEJ job on make install step
arifthpe Jun 30, 2025
bedc663
Merge branch 'main' into vagrant-automation
arifthpe Jun 30, 2025
57452a2
Bump all VMs to 4 cores and 4gb RAM
arifthpe Jul 1, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions util/devel/test/portability/provision-scripts/chapel-default.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#!/usr/bin/env bash

PROVISION_SCRIPTS_DIR=$(cd $(dirname ${BASH_SOURCE[0]}) ; pwd)

if [ ! -d chapel ]
then
../../provision-scripts/chapel-update.sh
$PROVISION_SCRIPTS_DIR/chapel-update.sh
fi

source ../../provision-scripts/chapel-setmakej.sh
source $PROVISION_SCRIPTS_DIR/chapel-setmakej.sh

echo "cd chapel && source util/setchplenv.bash && make $MAKEJ && make check"
cd chapel && source util/setchplenv.bash && make $MAKEJ && make check
echo "cd chapel && source util/setchplenv.bash && make $MAKEJ && make $MAKEJ check"
cd chapel && source util/setchplenv.bash && make $MAKEJ && make $MAKEJ check
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#!/usr/bin/env bash

PROVISION_SCRIPTS_DIR=$(cd $(dirname ${BASH_SOURCE[0]}) ; pwd)

if [ ! -d chapel ]
then
../../provision-scripts/chapel-update.sh
$PROVISION_SCRIPTS_DIR/chapel-update.sh
fi

source ../../provision-scripts/chapel-setmakej.sh
source $PROVISION_SCRIPTS_DIR/chapel-setmakej.sh

echo "cd chapel && source util/quickstart/setchplenv.bash && make $MAKEJ && make check"
cd chapel && source util/quickstart/setchplenv.bash && make $MAKEJ && make check
echo "cd chapel && source util/quickstart/setchplenv.bash && make $MAKEJ && make $MAKEJ check"
cd chapel && source util/quickstart/setchplenv.bash && make $MAKEJ && make $MAKEJ check
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh

# Adjustment needed to reliably work on network restricted test machines

mkdir -p /usr/local/etc/pkg/repos
echo 'FreeBSD: { url: "https://pkg.FreeBSD.org/${ABI}/quarterly", mirror_type: "none" }' > /usr/local/etc/pkg/repos/FreeBSD.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ if [ -d chapel ]
then
echo WARNING: chapel directory already exists, not cloning
else
git clone --reference-if-able "${REPO_CACHE_PATH:-/missing}/chapel.git" --depth 1 https://github.com/chapel-lang/chapel
git clone --reference-if-able "${REPO_CACHE_PATH:-/missing}/chapel.git" --depth 1 --branch=vagrant-automation https://github.com/arifthpe/chapel
fi
37 changes: 37 additions & 0 deletions util/devel/test/portability/provision-scripts/proxy-setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/sh
#
# Persists http_proxy and https_proxy variables in the VM environment if provided.

if [ -z "$http_proxy" ] || [ -z "$https_proxy" ]; then
echo "http_proxy or https_proxy was unset, not setting these variables in the VM"
exit 0
fi;

cat << EOF >> /etc/profile
export http_proxy=$http_proxy
export https_proxy=$https_proxy
export HTTP_PROXY=$http_proxy
export HTTPS_PROXY=$https_proxy
EOF

cat << EOF >> /etc/csh.cshrc
export http_proxy=$http_proxy
export https_proxy=$https_proxy
export HTTP_PROXY=$http_proxy
export HTTPS_PROXY=$https_proxy
EOF

# Hack to work on any sudoers file location
cat << EOF | EDITOR='tee -a' visudo
Defaults env_keep += "http_proxy"
Defaults env_keep += "https_proxy"
Defaults env_keep += "HTTP_PROXY"
Defaults env_keep += "HTTPS_PROXY"
EOF

cat << EOF >> /usr/local/etc/pkg.conf
pkg_env: {
http_proxy: "$http_proxy",
https_proxy: "$https_proxy",
}
EOF
2 changes: 1 addition & 1 deletion util/devel/test/portability/vagrant/chapeldefaultcheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
# Check if default (util/setchplenv) Chapel build passes make check
# Prints summary at the end

./tryit.sh 'bash -c '\''cd chapel && source util/setchplenv.bash && export GMAKE=`which gmake` && export MAKE=${GMAKE:-make} && $MAKE && $MAKE check'\'
./tryit.sh 'bash -c '\''cd chapel && source util/setchplenv.bash && export GMAKE=`which gmake` && export MAKE=${GMAKE:-make} && $MAKE $MAKEJ && $MAKE $MAKEJ check'\'
2 changes: 1 addition & 1 deletion util/devel/test/portability/vagrant/chapelshowcommit.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

# Show the current commit of each VM's chapel git repository
# Show the current commit of VM's chapel git repository

./tryit.sh "cd chapel && GIT_PAGER=cat git log --oneline -n 1 && GIT_PAGER=cat git diff"

2 changes: 1 addition & 1 deletion util/devel/test/portability/vagrant/chapelupdate.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

# Update the Chapel git repository in each VM to main
# Update the Chapel git repository in VM to main

./tryit.sh "cd chapel && git fetch origin --depth=1 && git checkout origin/main && GIT_PAGER=cat git log --oneline -n 1 && GIT_PAGER=cat git diff"

2 changes: 0 additions & 2 deletions util/devel/test/portability/vagrant/clobber.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/bin/bash

# make clobber in each VM's chapel directory

./tryit.sh "cd chapel && export GMAKE=`which gmake` && export MAKE=${GMAKE:-make} && $MAKE clobber"
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ Vagrant.configure("2") do |config|
# export VAGRANT_EXPERIMENTAL="disks"
config.vm.disk :disk, size: "12GB", primary: true

config.vm.provision "shell" do |s|
s.env = { http_proxy:ENV['http_proxy'], https_proxy:ENV['https_proxy'] }
s.path = "../../provision-scripts/proxy-setup.sh"
end

config.vm.provision "shell",
path: "../../provision-scripts/freebsd-repo-fix.sh"

config.vm.provision "shell",
path: "../../provision-scripts/freebsd-pkg-deps.sh"

Expand All @@ -27,7 +35,7 @@ Vagrant.configure("2") do |config|

config.vm.provider "virtualbox" do |vb|
vb.memory = 4096
# vb.cpus = 2
vb.cpus = 4
end

end
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ Vagrant.configure("2") do |config|
# export VAGRANT_EXPERIMENTAL="disks"
config.vm.disk :disk, size: "12GB", primary: true

config.vm.provision "shell" do |s|
s.env = { http_proxy:ENV['http_proxy'], https_proxy:ENV['https_proxy'] }
s.path = "../../provision-scripts/proxy-setup.sh"
end

config.vm.provision "shell",
path: "../../provision-scripts/freebsd-repo-fix.sh"

config.vm.provision "shell",
path: "../../provision-scripts/freebsd-pkg-deps.sh"

Expand All @@ -27,7 +35,7 @@ Vagrant.configure("2") do |config|

config.vm.provider "virtualbox" do |vb|
vb.memory = 4096
# vb.cpus = 2
vb.cpus = 4
end

end
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,17 @@ Vagrant.configure("2") do |config|
config.vm.box_architecture = "i386"
config.vm.box_version = "4.3.12"

config.vm.provision "shell" do |s|
s.env = { http_proxy:ENV['http_proxy'], https_proxy:ENV['https_proxy'] }
s.path = "../../provision-scripts/proxy-setup.sh"
end

# Hack to get this box to grab DNS nameservers from DHCP, rather than using
# the public DNS servers it for some reason has hardcoded.
config.vm.provision "shell",
inline: "sed -i 's/dns-nameserver/#dns-nameserver/' /etc/network/interfaces ;\
systemctl restart networking"

config.vm.provision "shell",
path: "../../provision-scripts/apt-get-deps.sh"

Expand All @@ -25,7 +36,7 @@ Vagrant.configure("2") do |config|

config.vm.provider "virtualbox" do |vb|
vb.memory = 4096
# vb.cpus = 2
vb.cpus = 4
end

end
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/jammy64"

config.vm.provision "shell" do |s|
s.env = { http_proxy:ENV['http_proxy'], https_proxy:ENV['https_proxy'] }
s.path = "../../provision-scripts/proxy-setup.sh"
end

config.vm.provision "shell", privileged: false,
path: "../../provision-scripts/apt-get-and-linuxbrew.sh"

Expand All @@ -19,7 +24,7 @@ Vagrant.configure("2") do |config|

config.vm.provider "virtualbox" do |vb|
vb.memory = 4096
# vb.cpus = 2
vb.cpus = 4
end

end
13 changes: 13 additions & 0 deletions util/devel/test/portability/vagrant/destroy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,23 @@
# Removes space occupied by each VM
# Don't do this if you have work you want to save in the VMs!

if [ -z "$VM_NAME" ]
then
echo "Please set the VM_NAME environment variable to the name of the VM you want to run this on."
exit 1
fi

for name in current/*
do
if [ -f $name/Vagrantfile ]
then
if [ "$VM_NAME" != "all" ]
then
if [ "$name" != "current/$VM_NAME" ]
then
continue
fi
fi
cd $name
echo "------------ $name ---- vagrant destroy"
vagrant destroy -f
Expand Down
2 changes: 1 addition & 1 deletion util/devel/test/portability/vagrant/gitclean.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash

# git clean in each VM's chapel directory
# git clean in VM's chapel directory

./tryit.sh "cd chapel && GIT_PAGER=cat git clean -fdx"
16 changes: 16 additions & 0 deletions util/devel/test/portability/vagrant/halt-all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

# Stop any running VMs

DIR=`pwd`

for name in current/*
do
if [ -f $name/Vagrantfile ]
then
cd $name
echo "------------ $name ---- vagrant halt"
vagrant halt
cd "$DIR"
fi
done
18 changes: 18 additions & 0 deletions util/devel/test/portability/vagrant/interact-all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

# Log in to each VM in turn to run commands manually
# Assumes VMs are up and leaves them running

for name in current/*
do
if [ -f $name/Vagrantfile ]
then
cd $name
echo "------------ $name ---- vagrant ssh"
#vagrant up
vagrant ssh
#vagrant halt
cd ..
fi
done

34 changes: 34 additions & 0 deletions util/devel/test/portability/vagrant/rebuild-all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash

# Rebuild all of the VMs. This will delete all data on the VMs.
# Don't do that if you have data you want to keep in any VM!

# enable resizing disks to get
# config.vm.disk to work
# (to resize the disk for some VMs that come too small)
export VAGRANT_EXPERIMENTAL="disks"

DIR=`pwd`

# Get new versions of Vagrant boxes
for name in current/*
do
if [ -f $name/Vagrantfile ]
then
cd $name
echo "------------ $name ---- vagrant box update"
# update the box
vagrant box update
# destroy the current VM
# (in case we need to make a new one with a new box)
vagrant destroy -f
# recreate the VM and install dependencies etc
vagrant up
# stop the VM
vagrant halt
cd "$DIR"
fi
done

# Remove any old (now unused) vagrant boxes
vagrant box prune
25 changes: 23 additions & 2 deletions util/devel/test/portability/vagrant/tryit.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
#!/bin/bash

# Runs a command (or series of commands) on all the VMs.
# Launches each VM, runs the command, and then shuts it down.
# Runs a command (or series of commands) on a VM.
# Launches the VM, runs the command, and then shuts it down.
# Prints a summary of the output at the end.
# Saves all the command output in the file called log.

# Expects the VM name to be given as an environment variable. The special name
# "all" can be used to run the command on all VMs.

if [ -z "$VM_NAME" ]
then
echo "Please set the VM_NAME environment variable to the name of the VM you want to run this on."
exit 1
fi

LOG=log

declare -a NAME
Expand Down Expand Up @@ -35,10 +44,19 @@ do
fi
done

exit_status=0
for name in current/*
do
if [ -f $name/Vagrantfile ]
then
# skip if this isn't a desired VM to run on
if [ "$VM_NAME" != "all" ]
then
if [ "$name" != "current/$VM_NAME" ]
then
continue
fi
fi
cd $name
display=`printf "%${maxlen}s" $name`
NAME[$i]=$display
Expand All @@ -64,6 +82,7 @@ do
echo " " $*
echo
echo
exit_status=1
#uncomment the below line to make errors fatal
#exit 1
;;
Expand All @@ -88,3 +107,5 @@ do
((i++))
fi
done

exit $exit_status
15 changes: 15 additions & 0 deletions util/devel/test/portability/vagrant/up-all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

# Bring each VM up and leave it running.

for name in current/*
do
if [ -f $name/Vagrantfile ]
then
cd $name
echo "------------ $name ---- vagrant up"
vagrant up
cd ../..
fi
done

Loading