Skip to content

Commit

Permalink
chore: Propagate all GitHub access tokens to all tests
Browse files Browse the repository at this point in the history
  • Loading branch information
twpayne committed Feb 20, 2022
1 parent 8714b95 commit c809a89
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 2 deletions.
9 changes: 8 additions & 1 deletion assets/docker/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,12 @@ for distribution in "$@"; do
exit 1
fi
image="$(docker build . -f "assets/docker/${distribution}.Dockerfile" -q)"
docker run --env "CHEZMOI_GITHUB_TOKEN=${CHEZMOI_GITHUB_TOKEN-}" --rm --volume "${PWD}:/chezmoi" "${image}"
docker run \
--env "CHEZMOI_GITHUB_ACCESS_TOKEN=${CHEZMOI_GITHUB_ACCESS_TOKEN-}" \
--env "CHEZMOI_GITHUB_TOKEN=${CHEZMOI_GITHUB_TOKEN-}" \
--env "GITHUB_ACCESS_TOKEN=${GITHUB_ACCESS_TOKEN-}" \
--env "GITHUB_TOKEN=${GITHUB_TOKEN-}" \
--rm \
--volume "${PWD}:/chezmoi" \
"${image}"
done
7 changes: 7 additions & 0 deletions assets/vagrant/debian11-i386.Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,12 @@ Vagrant.configure("2") do |config|
DEBIAN_FRONTEND=noninteractive apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y age gpg golang unzip xz-utils zip
SHELL
config.vm.provision "shell", inline: <<-SHELL
echo CHEZMOI_GITHUB_ACCESS_TOKEN=#{ENV['CHEZMOI_GITHUB_ACCESS_TOKEN']} >> /home/vagrant/.bash_profile
echo CHEZMOI_GITHUB_TOKEN=#{ENV['CHEZMOI_GITHUB_TOKEN']} >> /home/vagrant/.bash_profile
echo GITHUB_ACCESS_TOKEN=#{ENV['GITHUB_ACCESS_TOKEN']} >> /home/vagrant/.bash_profile
echo GITHUB_TOKEN=#{ENV['GITHUB_TOKEN']} >> /home/vagrant/.bash_profile
echo export CHEZMOI_GITHUB_ACCESS_TOKEN CHEZMOI_GITHUB_TOKEN GITHUB_ACCESS_TOKEN GITHUB_TOKEN >> /home/vagrant/.bash_profile
SHELL
config.vm.provision "file", source: "assets/vagrant/debian11-i386.test-chezmoi.sh", destination: "test-chezmoi.sh"
end
7 changes: 7 additions & 0 deletions assets/vagrant/freebsd13.Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,12 @@ Vagrant.configure("2") do |config|
config.vm.provision "shell", inline: <<-SHELL
pkg install --quiet --yes age git gnupg go zip
SHELL
config.vm.provision "shell", inline: <<-SHELL
echo CHEZMOI_GITHUB_ACCESS_TOKEN=#{ENV['CHEZMOI_GITHUB_ACCESS_TOKEN']} >> /home/vagrant/.bash_profile
echo CHEZMOI_GITHUB_TOKEN=#{ENV['CHEZMOI_GITHUB_TOKEN']} >> /home/vagrant/.bash_profile
echo GITHUB_ACCESS_TOKEN=#{ENV['GITHUB_ACCESS_TOKEN']} >> /home/vagrant/.bash_profile
echo GITHUB_TOKEN=#{ENV['GITHUB_TOKEN']} >> /home/vagrant/.bash_profile
echo export CHEZMOI_GITHUB_ACCESS_TOKEN CHEZMOI_GITHUB_TOKEN GITHUB_ACCESS_TOKEN GITHUB_TOKEN >> /home/vagrant/.bash_profile
SHELL
config.vm.provision "file", source: "assets/vagrant/freebsd13.test-chezmoi.sh", destination: "test-chezmoi.sh"
end
8 changes: 8 additions & 0 deletions assets/vagrant/openbsd6.Vagrantfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

Vagrant.configure("2") do |config|
config.vm.box = "generic/openbsd6"
config.vm.define :openbsd6
Expand All @@ -6,5 +7,12 @@ Vagrant.configure("2") do |config|
config.vm.provision "shell", inline: <<-SHELL
pkg_add -x bzip2 git gnupg go zip
SHELL
config.vm.provision "shell", inline: <<-SHELL
echo CHEZMOI_GITHUB_ACCESS_TOKEN=#{ENV['CHEZMOI_GITHUB_ACCESS_TOKEN']} >> /home/vagrant/.bash_profile
echo CHEZMOI_GITHUB_TOKEN=#{ENV['CHEZMOI_GITHUB_TOKEN']} >> /home/vagrant/.bash_profile
echo GITHUB_ACCESS_TOKEN=#{ENV['GITHUB_ACCESS_TOKEN']} >> /home/vagrant/.bash_profile
echo GITHUB_TOKEN=#{ENV['GITHUB_TOKEN']} >> /home/vagrant/.bash_profile
echo export CHEZMOI_GITHUB_ACCESS_TOKEN CHEZMOI_GITHUB_TOKEN GITHUB_ACCESS_TOKEN GITHUB_TOKEN >> /home/vagrant/.bash_profile
SHELL
config.vm.provision "file", source: "assets/vagrant/openbsd6.test-chezmoi.sh", destination: "test-chezmoi.sh"
end
6 changes: 6 additions & 0 deletions assets/vagrant/openindiana.Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,11 @@ Vagrant.configure("2") do |config|
config.vm.provision "shell", inline: <<-SHELL
pkg install -q compress/zip developer/gcc-7 developer/golang developer/versioning/git
SHELL
config.vm.provision "shell", inline: <<-SHELL
echo export CHEZMOI_GITHUB_ACCESS_TOKEN=#{ENV['CHEZMOI_GITHUB_ACCESS_TOKEN']} >> /export/home/vagrant/.profile
echo export CHEZMOI_GITHUB_TOKEN=#{ENV['CHEZMOI_GITHUB_TOKEN']} >> /export/home/vagrant/.profile
echo export GITHUB_ACCESS_TOKEN=#{ENV['GITHUB_ACCESS_TOKEN']} >> /export/home/vagrant/.profile
echo export GITHUB_TOKEN=#{ENV['GITHUB_TOKEN']} >> /export/home/vagrant/.profile
SHELL
config.vm.provision "file", source: "assets/vagrant/openindiana.test-chezmoi.sh", destination: "test-chezmoi.sh"
end
2 changes: 1 addition & 1 deletion pkg/cmd/testdata/scripts/doctor_unix.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ mksourcedir
# test that chezmoi doctor behaves as expected
chezmoi doctor
stdout '^ok\s+version\s+'
stdout '^\w+\s+latest-version\s+'
stdout '^warning\s+latest-version\s+'
stdout '^ok\s+os-arch\s+'
! stdout '^\S+\s+systeminfo\s+'
stdout '^ok\s+uname\s+'
Expand Down

0 comments on commit c809a89

Please sign in to comment.