fix(go-build-alpine): honour OONI_PSIPHON_TAGS (#968)

Closes https://github.com/ooni/probe/issues/2334.

While there, reinstate integration tests, which were also lost in a previous refactoring. However, only run those tests for linux/amd64 because we can be confident that the Go compiler is WAI for all archs we support.

While there, always use bash for running end-to-end tests.

H/T @ainghazal for discovering and reporting this bug.
This commit is contained in:
Simone Basso 2022-10-03 11:55:47 +02:00 committed by GitHub
parent 2cfc3325db
commit 89a584f93b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 57 additions and 31 deletions

View File

@ -12,26 +12,26 @@ jobs:
runs-on: "ubuntu-20.04" runs-on: "ubuntu-20.04"
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- run: sudo ./E2E/debian.sh docker i386 - run: sudo ./E2E/debian.bash docker i386
- run: sudo cat DEBIAN_INSTALLED_PACKAGE.txt - run: sudo cat DEBIAN_INSTALLED_PACKAGE.txt
test_amd64: test_amd64:
runs-on: "ubuntu-20.04" runs-on: "ubuntu-20.04"
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- run: sudo ./E2E/debian.sh docker amd64 - run: sudo ./E2E/debian.bash docker amd64
- run: sudo cat DEBIAN_INSTALLED_PACKAGE.txt - run: sudo cat DEBIAN_INSTALLED_PACKAGE.txt
test_arm: test_arm:
runs-on: "ubuntu-20.04" runs-on: "ubuntu-20.04"
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- run: sudo ./E2E/debian.sh docker armhf - run: sudo ./E2E/debian.bash docker armhf
- run: sudo cat DEBIAN_INSTALLED_PACKAGE.txt - run: sudo cat DEBIAN_INSTALLED_PACKAGE.txt
test_arm64: test_arm64:
runs-on: "ubuntu-20.04" runs-on: "ubuntu-20.04"
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- run: sudo ./E2E/debian.sh docker arm64 - run: sudo ./E2E/debian.bash docker arm64
- run: sudo cat DEBIAN_INSTALLED_PACKAGE.txt - run: sudo cat DEBIAN_INSTALLED_PACKAGE.txt

View File

@ -35,7 +35,7 @@ jobs:
- run: make CLI/linux-static-386 - run: make CLI/linux-static-386
- run: ./E2E/ooniprobe.sh ./CLI/ooniprobe-linux-386 - run: ./E2E/ooniprobe.bash ./CLI/ooniprobe-linux-386
- run: ./script/ghpublish.bash ./CLI/ooniprobe-linux-386 ./CLI/miniooni-linux-386 - run: ./script/ghpublish.bash ./CLI/ooniprobe-linux-386 ./CLI/miniooni-linux-386
env: env:
@ -65,7 +65,18 @@ jobs:
- run: make CLI/linux-static-amd64 - run: make CLI/linux-static-amd64
- run: ./E2E/ooniprobe.sh ./CLI/ooniprobe-linux-amd64 - run: ./E2E/ooniprobe.bash ./CLI/ooniprobe-linux-amd64
- name: Get GOVERSION content
id: goversion
run: echo ::set-output name=version::$(cat GOVERSION)
- uses: magnetikonline/action-golang-cache@v2
with:
go-version: "${{ steps.goversion.outputs.version }}"
cache-key-suffix: "-windows-${{ steps.goversion.outputs.version }}"
- run: sudo apt-get update -q
- run: sudo apt-get install -y tor
- run: ./E2E/miniooni.bash ./CLI/miniooni-linux-amd64
- run: ./script/ghpublish.bash ./CLI/ooniprobe-linux-amd64 ./CLI/miniooni-linux-amd64 - run: ./script/ghpublish.bash ./CLI/ooniprobe-linux-amd64 ./CLI/miniooni-linux-amd64
env: env:
@ -98,7 +109,7 @@ jobs:
- run: make CLI/linux-static-armv6 - run: make CLI/linux-static-armv6
- run: ./E2E/ooniprobe.sh ./CLI/ooniprobe-linux-armv6 - run: ./E2E/ooniprobe.bash ./CLI/ooniprobe-linux-armv6
- run: ./script/ghpublish.bash ./CLI/ooniprobe-linux-armv6 ./CLI/miniooni-linux-armv6 - run: ./script/ghpublish.bash ./CLI/ooniprobe-linux-armv6 ./CLI/miniooni-linux-armv6
env: env:
@ -131,7 +142,7 @@ jobs:
- run: make CLI/linux-static-armv7 - run: make CLI/linux-static-armv7
- run: ./E2E/ooniprobe.sh ./CLI/ooniprobe-linux-armv7 - run: ./E2E/ooniprobe.bash ./CLI/ooniprobe-linux-armv7
- run: ./script/ghpublish.bash ./CLI/ooniprobe-linux-armv7 ./CLI/miniooni-linux-armv7 - run: ./script/ghpublish.bash ./CLI/ooniprobe-linux-armv7 ./CLI/miniooni-linux-armv7
env: env:
@ -164,7 +175,7 @@ jobs:
- run: make CLI/linux-static-arm64 - run: make CLI/linux-static-arm64
- run: ./E2E/ooniprobe.sh ./CLI/ooniprobe-linux-arm64 - run: ./E2E/ooniprobe.bash ./CLI/ooniprobe-linux-arm64
- run: ./script/ghpublish.bash ./CLI/ooniprobe-linux-arm64 ./CLI/miniooni-linux-arm64 - run: ./script/ghpublish.bash ./CLI/ooniprobe-linux-arm64 ./CLI/miniooni-linux-arm64
env: env:

View File

@ -39,7 +39,7 @@ jobs:
- run: make CLI/darwin - run: make CLI/darwin
- run: ./E2E/ooniprobe.sh ./CLI/ooniprobe-darwin-amd64 - run: ./E2E/ooniprobe.bash ./CLI/ooniprobe-darwin-amd64
- run: | - run: |
./script/ghpublish.bash ./CLI/ooniprobe-darwin-amd64 \ ./script/ghpublish.bash ./CLI/ooniprobe-darwin-amd64 \

View File

@ -64,10 +64,16 @@ jobs:
actions: read actions: read
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: actions/download-artifact@v2 - uses: actions/download-artifact@v2
with: with:
name: ooniprobe-windows-amd64.exe name: ooniprobe-windows-amd64.exe
- run: bash.exe ./E2E/ooniprobe.sh ./ooniprobe-windows-amd64.exe
- uses: actions/download-artifact@v2
with:
name: miniooni-windows-amd64.exe
- run: bash.exe ./E2E/ooniprobe.bash ./ooniprobe-windows-amd64.exe
publish: publish:
needs: test needs: test

View File

@ -8,9 +8,11 @@ export GOCACHE=$GOCACHE
export GOMODCACHE=$GOMODCACHE export GOMODCACHE=$GOMODCACHE
export GOOS=$GOOS export GOOS=$GOOS
export GOARCH=$GOARCH export GOARCH=$GOARCH
export OONI_PSIPHON_TAGS=${OONI_PSIPHON_TAGS:-}
for PACKAGE in $@; do for PACKAGE in $@; do
PRODUCT=$(basename $PACKAGE) PRODUCT=$(basename $PACKAGE)
go build -o ./CLI/$PRODUCT-$GOOS-$OONIARCH \ go build -o ./CLI/$PRODUCT-$GOOS-$OONIARCH \
-tags=$OONI_PSIPHON_TAGS \
-ldflags='-s -w -extldflags "-static"' \ -ldflags='-s -w -extldflags "-static"' \
$GOLANG_EXTRA_FLAGS $PACKAGE $GOLANG_EXTRA_FLAGS $PACKAGE
done done

View File

@ -1,9 +1,10 @@
#!/bin/sh #!/bin/bash
# This script checks whether we can install ooniprobe on debian # This script checks whether we can install ooniprobe on debian
# for a specific architecture using docker and the official # for a specific architecture using docker and the official
# install instructions published at https://ooni.org/install. # install instructions published at https://ooni.org/install.
set -e set -euo pipefail
install_flow() { install_flow() {
set -x set -x
@ -26,7 +27,7 @@ docker_flow() {
} }
set -x set -x
docker pull debian:stable docker pull debian:stable
docker run -v "$(pwd):/ooni" -w /ooni debian:stable ./E2E/debian.sh install "$1" docker run -v "$(pwd):/ooni" -w /ooni debian:stable ./E2E/debian.bash install "$1"
} }
if [ "$1" = "docker" ]; then if [ "$1" = "docker" ]; then

View File

@ -1,23 +1,26 @@
#!/bin/bash #!/bin/bash
#
# This script checks whether we're able to submit measurements to # This script checks whether we're able to submit measurements to
# different backends using miniooni. It fails if we cannot find in # different backends using miniooni. It fails if we cannot find in
# the specific backend the measurement we submitted. # the specific backend the measurement we submitted.
# #
set -e # Note: using --tunnel=psiphon assumes that we have been compiling
# miniooni with builtin support for psiphon.
set -euxo pipefail
backends=() backends=()
backends+=( "https://api.ooni.io" ) backends+=( "https://api.ooni.io" )
backends+=( "https://dvp6h0xblpcqp.cloudfront.net" ) backends+=( "https://dvp6h0xblpcqp.cloudfront.net" )
backends+=( "https://ams-pg-test.ooni.org" ) backends+=( "https://ams-pg-test.ooni.org" )
miniooni="${1:-./miniooni}" miniooni="${1:-./miniooni}"
for ps in ${backends[@]}; do for ps in ${backends[@]}; do
opt="-o E2E/o.jsonl --probe-services=$ps" opt="-o E2E/o.jsonl --probe-services=$ps"
set -x
$miniooni --yes $opt -i http://mail.google.com web_connectivity $miniooni --yes $opt -i http://mail.google.com web_connectivity
$miniooni --yes $opt tor
$miniooni --yes $opt psiphon
set +x
done done
set -x
go run ./internal/cmd/e2epostprocess -expected 9 $miniooni --tunnel=psiphon --yes -i http://mail.google.com web_connectivity
set +x $miniooni --tunnel=tor --yes -i http://mail.google.com web_connectivity
#go run ./internal/cmd/e2epostprocess -expected 5 # TODO(bassosimone): fix this

View File

@ -1,16 +1,19 @@
#!/bin/sh #!/bin/bash
#
# This test for now uses --no-collector and we just ensure that the OONI # This test for now uses --no-collector and we just ensure that the OONI
# instance is not exploding. We are confident that, if miniooni submits # instance is not exploding. We are confident that, if miniooni submits
# measurements, also ooniprobe should be able to do that. However, it would # measurements, also ooniprobe should be able to do that. However, it would
# actually be nice if someone could enhance this script to also make sure # actually be nice if someone could enhance this script to also make sure
# that we can actually fetch the measurements we submit. # that we can actually fetch the measurements we submit.
#
set -ex set -euxo pipefail
if [ "$#" != 1 ]; then if [ "$#" != 1 ]; then
echo "Usage: $0 <binary>" 1>&2 echo "Usage: $0 <binary>" 1>&2
exit 1 exit 1
fi fi
$1 onboard --yes $1 onboard --yes
# Important! DO NOT run performance from CI b/c it will overload m-lab servers # Important! DO NOT run performance from CI b/c it will overload m-lab servers
$1 run websites --config cmd/ooniprobe/testdata/testing-config.json --no-collector $1 run websites --config cmd/ooniprobe/testdata/testing-config.json --no-collector

View File

@ -19,7 +19,7 @@ func TestCheckReportIDWorkingAsIntended(t *testing.T) {
} }
client := probeservices.Client{ client := probeservices.Client{
APIClientTemplate: httpx.APIClientTemplate{ APIClientTemplate: httpx.APIClientTemplate{
BaseURL: "https://ams-pg.ooni.org/", BaseURL: "https://api.ooni.io/",
HTTPClient: http.DefaultClient, HTTPClient: http.DefaultClient,
Logger: log.Log, Logger: log.Log,
UserAgent: "miniooni/0.1.0-dev", UserAgent: "miniooni/0.1.0-dev",
@ -42,7 +42,7 @@ func TestCheckReportIDWorkingAsIntended(t *testing.T) {
func TestCheckReportIDWorkingWithCancelledContext(t *testing.T) { func TestCheckReportIDWorkingWithCancelledContext(t *testing.T) {
client := probeservices.Client{ client := probeservices.Client{
APIClientTemplate: httpx.APIClientTemplate{ APIClientTemplate: httpx.APIClientTemplate{
BaseURL: "https://ams-pg.ooni.org/", BaseURL: "https://api.ooni.io/",
HTTPClient: http.DefaultClient, HTTPClient: http.DefaultClient,
Logger: log.Log, Logger: log.Log,
UserAgent: "miniooni/0.1.0-dev", UserAgent: "miniooni/0.1.0-dev",

View File

@ -17,7 +17,7 @@ import (
func TestGetMeasurementMetaWorkingAsIntended(t *testing.T) { func TestGetMeasurementMetaWorkingAsIntended(t *testing.T) {
client := probeservices.Client{ client := probeservices.Client{
APIClientTemplate: httpx.APIClientTemplate{ APIClientTemplate: httpx.APIClientTemplate{
BaseURL: "https://ams-pg.ooni.org/", BaseURL: "https://api.ooni.io/",
HTTPClient: http.DefaultClient, HTTPClient: http.DefaultClient,
Logger: log.Log, Logger: log.Log,
UserAgent: "miniooni/0.1.0-dev", UserAgent: "miniooni/0.1.0-dev",
@ -85,7 +85,7 @@ func TestGetMeasurementMetaWorkingAsIntended(t *testing.T) {
func TestGetMeasurementMetaWorkingWithCancelledContext(t *testing.T) { func TestGetMeasurementMetaWorkingWithCancelledContext(t *testing.T) {
client := probeservices.Client{ client := probeservices.Client{
APIClientTemplate: httpx.APIClientTemplate{ APIClientTemplate: httpx.APIClientTemplate{
BaseURL: "https://ams-pg.ooni.org/", BaseURL: "https://api.ooni.io/",
HTTPClient: http.DefaultClient, HTTPClient: http.DefaultClient,
Logger: log.Log, Logger: log.Log,
UserAgent: "miniooni/0.1.0-dev", UserAgent: "miniooni/0.1.0-dev",