[Nix-dev] help with Travis builds

Azul mail at azulinho.com
Fri Jun 10 20:51:47 CEST 2016


hmmm,

so I changed the Vagrantfile that was working and tried to break it (to
replicate the travis failed build), by adding the chroot option.
But it still works fine.

The Vagrantfile that fails is executing the same build steps as the travis
builds.
This is causing me an itch.



```
vbox_version = `VBoxManage --version`

Vagrant.configure(2) do |config|
  config.vm.box = "ubuntu/trusty64"
  config.vm.network "private_network", ip: "192.168.33.96", nic_type:
"virtio"

  config.vm.provider "virtualbox" do |vb|
     vb.memory = "3072"
     vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
     vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
     vb.customize [ "guestproperty", "set", :id,
"/VirtualBox/GuestAdd/VBoxService/--timesync-set-threshold", 10000 ]
     vb.customize ["modifyvm", :id, "--nictype1", "virtio"]
     vb.customize ["modifyvm", :id, "--paravirtprovider", "kvm"] if
vbox_version.to_f >= 5.0
     vb.customize ["storagectl", :id, "--name", "SATAController",
"--hostiocache", "on"]
     vb.customize ["modifyvm", :id, "--ioapic", "on"]
     vb.customize ["modifyvm", :id, "--cpus",
`#{RbConfig::CONFIG['host_os'] =~ /darwin/ ? 'sysctl -n hw.ncpu' :
'nproc'}`.chomp]

     vb.linked_clone = true if Vagrant::VERSION =~ /^1.8/
  end
  config.vm.provision "shell", privileged: true, inline: <<-SHELL
    groupadd nixbld
    usermod -G nixbld vagrant
    apt-get update
    apt-get install -y build-essential git
    test -e /swapfile || ( dd if=/dev/zero of=/swapfile bs=1M count=2048 &&
 mkswap /swapfile )
    swapon /swapfile || echo
  SHELL

  config.vm.provision "shell", privileged: false, inline: <<-SHELL
     git clone https://github.com/NixOS/nixpkgs.git
     cd nixpkgs
     git config --global user.email "me at example.com"
     git config --global user.name "Your Name"

     git remote add Azulinho https://github.com/Azulinho/nixpkgs.git
     set -e
     git fetch Azulinho
     git merge Azulinho/update_libgit2_to_v24
     set +e
     export NIXPKGS=$PWD
     export TRAVIS_PULL_REQUEST=15986
    ./maintainers/scripts/travis-nox-review-pr.sh nix
    ./maintainers/scripts/travis-nox-review-pr.sh nox
    . /home/vagrant/.nix-profile/etc/profile.d/nix.sh
    nix-build nixos/release.nix -A options --show-trace
    nix-build pkgs/top-level/release.nix -A tarball --show-trace
  SHELL

  config.vm.provision "shell", privileged: true, inline: <<-SHELL
    cd /home/vagrant/nixpkgs
    . /home/vagrant/.nix-profile/etc/profile.d/nix.sh
    nix-build --option build-use-chroot true $PWD -A python27Packages.pygit2
    nix-build --option build-use-chroot true $PWD -A python35Packages.pygit2
  SHELL
end
```


On 10 June 2016 at 09:06, zimbatm <zimbatm at zimbatm.com> wrote:

> It doesn't look like your vms are using the nix sandbox so some things
> could get picked from the environment?
>
> On Thu, 9 Jun 2016, 22:36 Azul, <mail at azulinho.com> wrote:
>
>> n00b here
>>
>> Trying to sort out PR: https://github.com/NixOS/nixpkgs/pull/15986
>>
>> while "it works on my machine", travis barks out at me with:
>> https://travis-ci.org/NixOS/nixpkgs/builds/135414974
>>
>> so I looked into the travis builds to find out what they were doing, and
>> come up with this to replicate them locally.
>>
>> This Vagrantfile fails with the same error as Travis
>>
>> ```
>> vbox_version = `VBoxManage --version`
>>
>> Vagrant.configure(2) do |config|
>>   config.vm.box = "ubuntu/trusty64"
>>   config.vm.network "private_network", ip: "192.168.33.96", nic_type:
>> "virtio"
>>
>>   config.vm.provider "virtualbox" do |vb|
>>      vb.memory = "3072"
>>      vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
>>      vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
>>      vb.customize [ "guestproperty", "set", :id,
>> "/VirtualBox/GuestAdd/VBoxService/--timesync-set-threshold", 10000 ]
>>      vb.customize ["modifyvm", :id, "--nictype1", "virtio"]
>>      vb.customize ["modifyvm", :id, "--paravirtprovider", "kvm"] if
>> vbox_version.to_f >= 5.0
>>      vb.customize ["storagectl", :id, "--name", "SATAController",
>> "--hostiocache", "on"]
>>      vb.customize ["modifyvm", :id, "--ioapic", "on"]
>>      vb.customize ["modifyvm", :id, "--cpus",
>> `#{RbConfig::CONFIG['host_os'] =~ /darwin/ ? 'sysctl -n hw.ncpu' :
>> 'nproc'}`.chomp]
>>
>>      vb.linked_clone = true if Vagrant::VERSION =~ /^1.8/
>>   end
>>   config.vm.provision "shell", inline: <<-SHELL
>>     groupadd nixbld
>>     usermod -G nixbld vagrant
>>     apt-get update
>>     apt-get install -y build-essential git
>>     test -e /swapfile || ( dd if=/dev/zero of=/swapfile bs=1M count=2048
>> &&  mkswap /swapfile )
>>     swapon /swapfile
>>   SHELL
>>
>>   config.vm.provision "shell", privileged: false, inline: <<-SHELL
>>      git clone https://github.com/NixOS/nixpkgs.git
>>      cd nixpkgs
>>      export TRAVIS_PULL_REQUEST=15986
>>     ./maintainers/scripts/travis-nox-review-pr.sh nix
>>     ./maintainers/scripts/travis-nox-review-pr.sh nox
>>     ./maintainers/scripts/travis-nox-review-pr.sh build
>>   SHELL
>> end
>> ```
>>
>>
>> But this Vagrantfile builds my PR correctly
>>
>> ```
>> vbox_version = `VBoxManage --version`
>>
>> Vagrant.configure(2) do |config|
>>   config.vm.box = "ubuntu/trusty64"
>>   config.vm.network "private_network", ip: "192.168.33.96", nic_type:
>> "virtio"
>>
>>   config.vm.provider "virtualbox" do |vb|
>>      vb.memory = "3072"
>>      vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
>>      vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
>>      vb.customize [ "guestproperty", "set", :id,
>> "/VirtualBox/GuestAdd/VBoxService/--timesync-set-threshold", 10000 ]
>>      vb.customize ["modifyvm", :id, "--nictype1", "virtio"]
>>      vb.customize ["modifyvm", :id, "--paravirtprovider", "kvm"] if
>> vbox_version.to_f >= 5.0
>>      vb.customize ["storagectl", :id, "--name", "SATAController",
>> "--hostiocache", "on"]
>>      vb.customize ["modifyvm", :id, "--ioapic", "on"]
>>      vb.customize ["modifyvm", :id, "--cpus",
>> `#{RbConfig::CONFIG['host_os'] =~ /darwin/ ? 'sysctl -n hw.ncpu' :
>> 'nproc'}`.chomp]
>>
>>      vb.linked_clone = true if Vagrant::VERSION =~ /^1.8/
>>   end
>>   config.vm.provision "shell", inline: <<-SHELL
>>     groupadd nixbld
>>     usermod -G nixbld vagrant
>>     apt-get update
>>     apt-get install -y build-essential git
>>     test -e /swapfile || ( dd if=/dev/zero of=/swapfile bs=1M count=2048
>> &&  mkswap /swapfile )
>>     swapon /swapfile || echo
>>   SHELL
>>
>>   config.vm.provision "shell", privileged: false, inline: <<-SHELL
>>      git clone https://github.com/NixOS/nixpkgs.git
>>      cd nixpkgs
>>      git config --global user.email "me at example.com"
>>      git config --global user.name "Your Name"
>>
>>      git remote add Azulinho https://github.com/Azulinho/nixpkgs.git
>>      git fetch Azulinho
>>      git merge Azulinho/update_libgit2_to_v24
>>      export NIXPKGS=$PWD
>>      export TRAVIS_PULL_REQUEST=15986
>>     ./maintainers/scripts/travis-nox-review-pr.sh nix
>>     ./maintainers/scripts/travis-nox-review-pr.sh nox
>>     . $HOME/.nix-profile/etc/profile.d/nix.sh
>>     nix-build nixos/release.nix -A options --show-trace
>>     nix-build pkgs/top-level/release.nix -A tarball --show-trace
>>     nix-build $PWD -A python27Packages.pygit2
>>     nix-build $PWD -A python35Packages.pygit2
>>   SHELL
>> end
>> ```
>>
>> Before I dig into reading about nox and getting into the grittier
>> details, does anyone has a hint for what could possibly be happening here?
>> happy to pay back with a merged PR
>>
>> - azul
>>
>> _______________________________________________
>> nix-dev mailing list
>> nix-dev at lists.science.uu.nl
>> http://lists.science.uu.nl/mailman/listinfo/nix-dev
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.science.uu.nl/pipermail/nix-dev/attachments/20160610/937d2c26/attachment-0001.html>


More information about the nix-dev mailing list