Skip to content
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

RFC: Support Alpine Linux #453

Open
YOU54F opened this issue Sep 5, 2024 · 1 comment · May be fixed by #454
Open

RFC: Support Alpine Linux #453

YOU54F opened this issue Sep 5, 2024 · 1 comment · May be fixed by #454

Comments

@YOU54F
Copy link
Member

YOU54F commented Sep 5, 2024

Rationale

We have warnings in the code, if on Alpine - See #246

but we now have native musl based shared libraries for the pact_ffi

https://github.com/pact-foundation/pact-reference/releases/tag/libpact_ffi-v0.4.23

It would be nice to add proper support for these variants in pact-go

Approach

  1. When detecting musl, instead of warning user, provide download for *.so musl variant in https://github.com/pact-foundation/pact-go/blob/master/installer/installer.go
  2. Update tests to reflect https://github.com/pact-foundation/pact-go/blob/master/installer/installer_test.go
  3. Create Dockerfile for golang alpine https://github.com/pact-foundation/pact-go/blob/master/Dockerfile
  4. Update Makefile to run either debian or alpine based image

    pact-go/Makefile

    Lines 39 to 58 in a1e63fc

    docker_build:
    docker build -f Dockerfile --build-arg GO_VERSION=${GO_VERSION} -t pactfoundation/pact-go-test .
    docker_test: docker_build
    docker run \
    -e LOG_LEVEL=INFO \
    --rm \
    pactfoundation/pact-go-test \
    /bin/sh -c "make test"
    docker_pact: docker_build
    docker run \
    -e LOG_LEVEL=INFO \
    --rm \
    pactfoundation/pact-go-test \
    /bin/sh -c "make pact_local"
    docker_test_all: docker_build
    docker run \
    -e LOG_LEVEL=INFO \
    --rm \
    pactfoundation/pact-go-test \
    /bin/sh -c "make test && make pact_local"
  5. Update CI to test amd64 alpine variant
    test-containers:
    runs-on: ubuntu-latest
    name: ${{ matrix.go-version }}-test-container
    strategy:
    fail-fast: false
    matrix:
    go-version: ["1.21", "1.22"]
    steps:
    - uses: actions/checkout@v4
    - name: Test dockerfile
    run: make docker_test_all
    env:
    GO_VERSION: ${{ matrix.go-version }}
@YOU54F
Copy link
Member Author

YOU54F commented Sep 5, 2024

Tried this out

https://github.com/YOU54F/pact-go/actions/runs/10728828875/job/29754218172

works fine on the consumer side, but getting segfaults in the provider side. I have a hunch its relating to the proxy code

SIGSEGV: segmentation violation
PC=0x7f09e5a12ca3 m=6 sigcode=2 addr=0x7f099ebf7a00
signal arrived during cgo execution

goroutine 5 gp=0xc000103dc0 m=6 mp=0xc000096008 [syscall]:
runtime.cgocall(0x9df100, 0xc000047338)
	/usr/local/go/src/runtime/cgocall.go:157 +0x4b fp=0xc000047310 sp=0xc0000472d8 pc=0x40bd2b
github.com/pact-foundation/pact-go/v2/internal/native._Cfunc_pactffi_verifier_execute(0x7f099ea0aa60)
	_cgo_gotypes.go:727 +0x47 fp=0xc000047338 sp=0xc000047310 pc=0x94c187
github.com/pact-foundation/pact-go/v2/internal/native.(*Verifier).Execute.func1(0xc000849340?)
	/go/src/github.com/pact-foundation/pact-go/internal/native/verifier.go:198 +0x3e fp=0xc000047378 sp=0xc000047338 pc=0x9576be
github.com/pact-foundation/pact-go/v2/internal/native.(*Verifier).Execute(0xc000582b88?)
	/go/src/github.com/pact-foundation/pact-go/internal/native/verifier.go:198 +0x17 fp=0xc0000473c0 sp=0xc000047378 pc=0x9575d7
github.com/pact-foundation/pact-go/v2/provider.(*VerifyRequest).Verify(0xc000047720, 0xc000582b88, {0x2?, 0xc0000476a8?})
	/go/src/github.com/pact-foundation/pact-go/provider/verify_request.go:304 +0x21a fp=0xc0000474c8 sp=0xc0000473c0 pc=0x9db71a
github.com/pact-foundation/pact-go/v2/provider.(*Verifier).verifyProviderRaw(_, {{0xc000146768, 0x16}, {0x0, 0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0, ...}, ...}, ...)
	/go/src/github.com/pact-foundation/pact-go/provider/verifier.go:169 +0xc8f fp=0xc000047720 sp=0xc0000474c8 pc=0x9d7b4f
github.com/pact-foundation/pact-go/v2/provider.(*Verifier).VerifyProvider(_, _, {{0xb3452d, 0x15}, {0x0, 0x0, 0x0}, {0x0, 0x0}, {0x0, ...}, ...})
	/go/src/github.com/pact-foundation/pact-go/provider/verifier.go:176 +0x65 fp=0xc000047938 sp=0xc000047720 pc=0x9d9445
github.com/pact-foundation/pact-go/v2/examples.TestV3HTTPProvider(0xc0000c6000)
	/go/src/github.com/pact-foundation/pact-go/examples/provider_test.go:99 +0x548 fp=0xc000047f70 sp=0xc000047938 pc=0x9dca08

<snip>

@YOU54F YOU54F linked a pull request Sep 5, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant