From 96ea9dbff6cc6ea530771d545879ad1226864a9b Mon Sep 17 00:00:00 2001 From: Maximilian Kratz Date: Fri, 10 Mar 2023 14:31:53 +0100 Subject: [PATCH 1/5] Fixes wrong VM name in Vagrantfile Cosmetic change/fix --- Vagrantfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Vagrantfile b/Vagrantfile index bd7c190..fba09e9 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -1,6 +1,6 @@ Vagrant.configure("2") do |config| config.vm.box = "gusztavvargadr/ubuntu-desktop-2004-lts-xfce" - config.vm.define 'ubuntu' + config.vm.define 'emoflon' config.vm.provider :virtualbox do |vb| vb.name = "emoflon" vb.memory = 8192 From 98a9b2c87d6fba6626fa1cf9a8ea38823fe23485 Mon Sep 17 00:00:00 2001 From: Maximilian Kratz Date: Fri, 10 Mar 2023 14:34:37 +0100 Subject: [PATCH 2/5] Adds GitHub token for autorization bearer to API calls --- Vagrantfile | 4 +++- prov.sh | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index fba09e9..166e309 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -1,3 +1,5 @@ +token = ENV["GITHUB_TOKEN"] + Vagrant.configure("2") do |config| config.vm.box = "gusztavvargadr/ubuntu-desktop-2004-lts-xfce" config.vm.define 'emoflon' @@ -6,7 +8,7 @@ Vagrant.configure("2") do |config| vb.memory = 8192 vb.cpus = 2 end - config.vm.provision "shell", path: "prov.sh", privileged: false + config.vm.provision "shell", path: "prov.sh", env: {"GITHUB_TOKEN" => token}, privileged: false # Prevent SharedFoldersEnableSymlinksCreate errors config.vm.synced_folder ".", "/vagrant", disabled: true diff --git a/prov.sh b/prov.sh index eba3a41..7b0e396 100644 --- a/prov.sh +++ b/prov.sh @@ -47,10 +47,11 @@ cd ~/eclipse-apps if [[ ! -f "./$ECLIPSE_ARCHIVE.zip" ]]; then log "Downloading latest eMoflon Eclipse archive from Github." curl -s https://api.github.com/repos/eMoflon/emoflon-ibex-eclipse-build/releases/latest \ + --header 'authorization: Bearer ${GITHUB_TOKEN}' \ | grep "$ECLIPSE_ARCHIVE.zip" \ | cut -d : -f 2,3 \ | tr -d \" \ - | wget -q -i - \ + | wget -q -i --header="Authorization: Bearer ${GITHUB_TOKEN}" - \ || : fi From a682d9e5e7b3a17c444cad1b643d6fbc55433250 Mon Sep 17 00:00:00 2001 From: Maximilian Kratz Date: Fri, 10 Mar 2023 14:42:05 +0100 Subject: [PATCH 3/5] Fixes ENV secret access in Vagrantfile --- Vagrantfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Vagrantfile b/Vagrantfile index 166e309..2c2e14e 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -1,4 +1,4 @@ -token = ENV["GITHUB_TOKEN"] +token = ENV["secrets.GITHUB_TOKEN"] Vagrant.configure("2") do |config| config.vm.box = "gusztavvargadr/ubuntu-desktop-2004-lts-xfce" From 642fe615bb668c8c80bc009cdc0ce43504895dd6 Mon Sep 17 00:00:00 2001 From: Maximilian Kratz Date: Fri, 10 Mar 2023 15:24:07 +0100 Subject: [PATCH 4/5] Fixes GITHUB_TOKEN env for auth against the REST API --- .github/workflows/vagrant-up.yml | 2 ++ Vagrantfile | 2 +- prov.sh | 6 +++--- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/vagrant-up.yml b/.github/workflows/vagrant-up.yml index 98a59a4..41cd20d 100644 --- a/.github/workflows/vagrant-up.yml +++ b/.github/workflows/vagrant-up.yml @@ -37,6 +37,8 @@ jobs: run: | vagrant up echo "=> Vagrant run finished." + env: + GITHUB_TOKEN: ${{ github.token }} - name: export virtualbox VM run: | vagrant halt diff --git a/Vagrantfile b/Vagrantfile index 2c2e14e..166e309 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -1,4 +1,4 @@ -token = ENV["secrets.GITHUB_TOKEN"] +token = ENV["GITHUB_TOKEN"] Vagrant.configure("2") do |config| config.vm.box = "gusztavvargadr/ubuntu-desktop-2004-lts-xfce" diff --git a/prov.sh b/prov.sh index 7b0e396..aba1ca6 100644 --- a/prov.sh +++ b/prov.sh @@ -46,12 +46,12 @@ cd ~/eclipse-apps # Get eclipse if [[ ! -f "./$ECLIPSE_ARCHIVE.zip" ]]; then log "Downloading latest eMoflon Eclipse archive from Github." - curl -s https://api.github.com/repos/eMoflon/emoflon-ibex-eclipse-build/releases/latest \ - --header 'authorization: Bearer ${GITHUB_TOKEN}' \ + curl -s --header "Authorization: Bearer ${GITHUB_TOKEN}" \ + https://api.github.com/repos/eMoflon/emoflon-ibex-eclipse-build/releases/latest \ | grep "$ECLIPSE_ARCHIVE.zip" \ | cut -d : -f 2,3 \ | tr -d \" \ - | wget -q -i --header="Authorization: Bearer ${GITHUB_TOKEN}" - \ + | wget --header="Authorization: Bearer ${GITHUB_TOKEN}" -i - \ || : fi From ab8f4d9f3197bfcfb4dc19028e6a1dbd739691fd Mon Sep 17 00:00:00 2001 From: Maximilian Kratz Date: Fri, 10 Mar 2023 15:29:29 +0100 Subject: [PATCH 5/5] Re-adds -q parameter to wget --- prov.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prov.sh b/prov.sh index aba1ca6..22f7e25 100644 --- a/prov.sh +++ b/prov.sh @@ -51,7 +51,7 @@ if [[ ! -f "./$ECLIPSE_ARCHIVE.zip" ]]; then | grep "$ECLIPSE_ARCHIVE.zip" \ | cut -d : -f 2,3 \ | tr -d \" \ - | wget --header="Authorization: Bearer ${GITHUB_TOKEN}" -i - \ + | wget -q --header="Authorization: Bearer ${GITHUB_TOKEN}" -i - \ || : fi