Skip to content

Commit

Permalink
Merge remote-tracking branch 'prebid/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
PGAMSSP committed Nov 18, 2024
2 parents f091f59 + 63af8af commit 4eb4dca
Show file tree
Hide file tree
Showing 1,352 changed files with 19,705 additions and 7,073 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"dockerfile": "Dockerfile",
"args": {
// Update the VARIANT arg to pick a version of Go
"VARIANT": "1.20",
"VARIANT": "1.22",
// Options
"INSTALL_NODE": "false",
"NODE_VERSION": "lts/*"
Expand Down
14 changes: 10 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,20 @@ WORKDIR /app/prebid-server/
ENV GOROOT=/usr/local/go
ENV PATH=$GOROOT/bin:$PATH
ENV GOPROXY="https://proxy.golang.org"

# Installing gcc as cgo uses it to build native code of some modules
RUN apt-get update && \
apt-get install -y git && \
apt-get install -y git gcc && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
ENV CGO_ENABLED 0

# CGO must be enabled because some modules depend on native C code
ENV CGO_ENABLED 1
COPY ./ ./
RUN go mod tidy
RUN go mod vendor
ARG TEST="true"
RUN if [ "$TEST" != "false" ]; then ./validate.sh ; fi
RUN go build -mod=vendor -ldflags "-X github.com/prebid/prebid-server/v2/version.Ver=`git describe --tags | sed 's/^v//'` -X github.com/prebid/prebid-server/v2/version.Rev=`git rev-parse HEAD`" .
RUN go build -mod=vendor -ldflags "-X github.com/prebid/prebid-server/v3/version.Ver=`git describe --tags | sed 's/^v//'` -X github.com/prebid/prebid-server/v3/version.Rev=`git rev-parse HEAD`" .

FROM ubuntu:20.04 AS release
LABEL maintainer="hans.hjort@xandr.com"
Expand All @@ -30,8 +34,10 @@ RUN chmod a+xr prebid-server
COPY static static/
COPY stored_requests/data stored_requests/data
RUN chmod -R a+r static/ stored_requests/data

# Installing libatomic1 as it is a runtime dependency for some modules
RUN apt-get update && \
apt-get install -y ca-certificates mtr && \
apt-get install -y ca-certificates mtr libatomic1 && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN adduser prebid_user
USER prebid_user
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ test: deps
ifeq "$(adapter)" ""
./validate.sh
else
go test github.com/prebid/prebid-server/v2/adapters/$(adapter) -bench=.
go test github.com/prebid/prebid-server/v3/adapters/$(adapter) -bench=.
endif

# build-modules generates modules/builder.go file which provides a list of all available modules
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ or compile a standalone binary using the command:
``` bash
go build .
```
**Note:** if building from source there are a couple dependencies to be aware of:
1. *Compile-time*. Some modules ship native code that requires `cgo` (comes with the `go` compiler) being enabled - by default it is and environment variable `CGO_ENABLED=1` do NOT set it to `0`.
2. *Compile-time*. `cgo` depends on the C-compiler, which usually is `gcc`, but can be changed by setting the value of `CC` env var, f.e. `CC=clang`. On ubuntu `gcc` can be installed via `sudo apt-get install gcc`.
3. *Runtime*. Some modules require `libatomic`. On ubuntu it is installed by running `sudo apt-get install libatomic1`. `libatomic1` is a dependency of `gcc`, so if you are building with `gcc` and running on the same machine, it is likely that `libatomic1` is already installed.

Ensure that you deploy the `/static` directory, as Prebid Server requires those files at startup.

## Developing
Expand Down
14 changes: 7 additions & 7 deletions account/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import (

"github.com/prebid/go-gdpr/consentconstants"

"github.com/prebid/prebid-server/v2/config"
"github.com/prebid/prebid-server/v2/errortypes"
"github.com/prebid/prebid-server/v2/metrics"
"github.com/prebid/prebid-server/v2/openrtb_ext"
"github.com/prebid/prebid-server/v2/stored_requests"
"github.com/prebid/prebid-server/v2/util/iputil"
"github.com/prebid/prebid-server/v2/util/jsonutil"
"github.com/prebid/prebid-server/v3/config"
"github.com/prebid/prebid-server/v3/errortypes"
"github.com/prebid/prebid-server/v3/metrics"
"github.com/prebid/prebid-server/v3/openrtb_ext"
"github.com/prebid/prebid-server/v3/stored_requests"
"github.com/prebid/prebid-server/v3/util/iputil"
"github.com/prebid/prebid-server/v3/util/jsonutil"
)

// GetAccount looks up the config.Account object referenced by the given accountID, with access rules applied
Expand Down
14 changes: 7 additions & 7 deletions account/account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import (
"fmt"
"testing"

"github.com/prebid/prebid-server/v2/config"
"github.com/prebid/prebid-server/v2/errortypes"
"github.com/prebid/prebid-server/v2/metrics"
"github.com/prebid/prebid-server/v2/openrtb_ext"
"github.com/prebid/prebid-server/v2/stored_requests"
"github.com/prebid/prebid-server/v2/util/iputil"
"github.com/prebid/prebid-server/v2/util/ptrutil"
"github.com/prebid/prebid-server/v3/config"
"github.com/prebid/prebid-server/v3/errortypes"
"github.com/prebid/prebid-server/v3/metrics"
"github.com/prebid/prebid-server/v3/openrtb_ext"
"github.com/prebid/prebid-server/v3/stored_requests"
"github.com/prebid/prebid-server/v3/util/iputil"
"github.com/prebid/prebid-server/v3/util/ptrutil"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
)
Expand Down
21 changes: 11 additions & 10 deletions adapters/33across/33across.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ import (

"github.com/prebid/openrtb/v20/adcom1"
"github.com/prebid/openrtb/v20/openrtb2"
"github.com/prebid/prebid-server/v2/adapters"
"github.com/prebid/prebid-server/v2/config"
"github.com/prebid/prebid-server/v2/errortypes"
"github.com/prebid/prebid-server/v2/openrtb_ext"
"github.com/prebid/prebid-server/v3/adapters"
"github.com/prebid/prebid-server/v3/config"
"github.com/prebid/prebid-server/v3/errortypes"
"github.com/prebid/prebid-server/v3/openrtb_ext"
"github.com/prebid/prebid-server/v3/util/jsonutil"
)

type TtxAdapter struct {
Expand Down Expand Up @@ -76,7 +77,7 @@ func (a *TtxAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapter
// Skip over imps whose extensions cannot be read since
// we cannot glean Prod or ZoneID which are required to
// group together. However let's not block request creation.
if err := json.Unmarshal(impCopy.Ext, &impExt); err == nil {
if err := jsonutil.Unmarshal(impCopy.Ext, &impExt); err == nil {
impKey := impExt.Ttx.Prod + impExt.Ttx.Zoneid
groupedImps[impKey] = append(groupedImps[impKey], impCopy)
} else {
Expand Down Expand Up @@ -126,14 +127,14 @@ func makeImps(imp openrtb2.Imp) (openrtb2.Imp, error) {
}

var bidderExt adapters.ExtImpBidder
if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil {
if err := jsonutil.Unmarshal(imp.Ext, &bidderExt); err != nil {
return openrtb2.Imp{}, &errortypes.BadInput{
Message: err.Error(),
}
}

var ttxExt openrtb_ext.ExtImp33across
if err := json.Unmarshal(bidderExt.Bidder, &ttxExt); err != nil {
if err := jsonutil.Unmarshal(bidderExt.Bidder, &ttxExt); err != nil {
return openrtb2.Imp{}, &errortypes.BadInput{
Message: err.Error(),
}
Expand Down Expand Up @@ -177,7 +178,7 @@ func makeReqExt(request *openrtb2.BidRequest) ([]byte, error) {
var reqExt reqExt

if len(request.Ext) > 0 {
if err := json.Unmarshal(request.Ext, &reqExt); err != nil {
if err := jsonutil.Unmarshal(request.Ext, &reqExt); err != nil {
return nil, err
}
}
Expand Down Expand Up @@ -215,7 +216,7 @@ func (a *TtxAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequ

var bidResp openrtb2.BidResponse

if err := json.Unmarshal(response.Body, &bidResp); err != nil {
if err := jsonutil.Unmarshal(response.Body, &bidResp); err != nil {
return nil, []error{err}
}

Expand All @@ -226,7 +227,7 @@ func (a *TtxAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequ
var bidExt bidExt
var bidType openrtb_ext.BidType

if err := json.Unmarshal(sb.Bid[i].Ext, &bidExt); err != nil {
if err := jsonutil.Unmarshal(sb.Bid[i].Ext, &bidExt); err != nil {
bidType = openrtb_ext.BidTypeBanner
} else {
bidType = getBidType(bidExt)
Expand Down
6 changes: 3 additions & 3 deletions adapters/33across/33across_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package ttx
import (
"testing"

"github.com/prebid/prebid-server/v2/adapters/adapterstest"
"github.com/prebid/prebid-server/v2/config"
"github.com/prebid/prebid-server/v2/openrtb_ext"
"github.com/prebid/prebid-server/v3/adapters/adapterstest"
"github.com/prebid/prebid-server/v3/config"
"github.com/prebid/prebid-server/v3/openrtb_ext"
)

func TestJsonSamples(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion adapters/33across/params_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"encoding/json"
"testing"

"github.com/prebid/prebid-server/v2/openrtb_ext"
"github.com/prebid/prebid-server/v3/openrtb_ext"
)

// This file actually intends to test static/bidder-params/33across.json
Expand Down
13 changes: 7 additions & 6 deletions adapters/aax/aax.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ import (
"net/url"

"github.com/prebid/openrtb/v20/openrtb2"
"github.com/prebid/prebid-server/v2/adapters"
"github.com/prebid/prebid-server/v2/config"
"github.com/prebid/prebid-server/v2/errortypes"
"github.com/prebid/prebid-server/v2/openrtb_ext"
"github.com/prebid/prebid-server/v3/adapters"
"github.com/prebid/prebid-server/v3/config"
"github.com/prebid/prebid-server/v3/errortypes"
"github.com/prebid/prebid-server/v3/openrtb_ext"
"github.com/prebid/prebid-server/v3/util/jsonutil"
)

type adapter struct {
Expand Down Expand Up @@ -63,7 +64,7 @@ func (a *adapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest

var bidResp openrtb2.BidResponse

if err := json.Unmarshal(response.Body, &bidResp); err != nil {
if err := jsonutil.Unmarshal(response.Body, &bidResp); err != nil {
return nil, []error{err}
}

Expand Down Expand Up @@ -96,7 +97,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter, server co

func getMediaTypeForImp(bid openrtb2.Bid, imps []openrtb2.Imp) (openrtb_ext.BidType, error) {
var bidExt aaxResponseBidExt
err := json.Unmarshal(bid.Ext, &bidExt)
err := jsonutil.Unmarshal(bid.Ext, &bidExt)
if err == nil {
switch bidExt.AdCodeType {
case "banner":
Expand Down
6 changes: 3 additions & 3 deletions adapters/aax/aax_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (

"github.com/stretchr/testify/assert"

"github.com/prebid/prebid-server/v2/adapters/adapterstest"
"github.com/prebid/prebid-server/v2/config"
"github.com/prebid/prebid-server/v2/openrtb_ext"
"github.com/prebid/prebid-server/v3/adapters/adapterstest"
"github.com/prebid/prebid-server/v3/config"
"github.com/prebid/prebid-server/v3/openrtb_ext"
)

func TestJsonSamples(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion adapters/aax/params_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"encoding/json"
"testing"

"github.com/prebid/prebid-server/v2/openrtb_ext"
"github.com/prebid/prebid-server/v3/openrtb_ext"
)

// This file actually intends to test static/bidder-params/aax.json
Expand Down
17 changes: 9 additions & 8 deletions adapters/aceex/aceex.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ import (
"text/template"

"github.com/prebid/openrtb/v20/openrtb2"
"github.com/prebid/prebid-server/v2/adapters"
"github.com/prebid/prebid-server/v2/config"
"github.com/prebid/prebid-server/v2/errortypes"
"github.com/prebid/prebid-server/v2/macros"
"github.com/prebid/prebid-server/v2/openrtb_ext"
"github.com/prebid/prebid-server/v3/adapters"
"github.com/prebid/prebid-server/v3/config"
"github.com/prebid/prebid-server/v3/errortypes"
"github.com/prebid/prebid-server/v3/macros"
"github.com/prebid/prebid-server/v3/openrtb_ext"
"github.com/prebid/prebid-server/v3/util/jsonutil"
)

type adapter struct {
Expand Down Expand Up @@ -90,13 +91,13 @@ func (a *adapter) MakeRequests(

func (a *adapter) getImpressionExt(imp *openrtb2.Imp) (*openrtb_ext.ExtAceex, error) {
var bidderExt adapters.ExtImpBidder
if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil {
if err := jsonutil.Unmarshal(imp.Ext, &bidderExt); err != nil {
return nil, &errortypes.BadInput{
Message: "ext.bidder not provided",
}
}
var aceexExt openrtb_ext.ExtAceex
if err := json.Unmarshal(bidderExt.Bidder, &aceexExt); err != nil {
if err := jsonutil.Unmarshal(bidderExt.Bidder, &aceexExt); err != nil {
return nil, &errortypes.BadInput{
Message: "ext.bidder not provided",
}
Expand Down Expand Up @@ -151,7 +152,7 @@ func (a *adapter) MakeBids(

responseBody := bidderRawResponse.Body
var bidResp openrtb2.BidResponse
if err := json.Unmarshal(responseBody, &bidResp); err != nil {
if err := jsonutil.Unmarshal(responseBody, &bidResp); err != nil {
return nil, []error{&errortypes.BadServerResponse{
Message: "Bad Server Response",
}}
Expand Down
6 changes: 3 additions & 3 deletions adapters/aceex/aceex_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package aceex
import (
"testing"

"github.com/prebid/prebid-server/v2/adapters/adapterstest"
"github.com/prebid/prebid-server/v2/config"
"github.com/prebid/prebid-server/v2/openrtb_ext"
"github.com/prebid/prebid-server/v3/adapters/adapterstest"
"github.com/prebid/prebid-server/v3/config"
"github.com/prebid/prebid-server/v3/openrtb_ext"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion adapters/aceex/params_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"encoding/json"
"testing"

"github.com/prebid/prebid-server/v2/openrtb_ext"
"github.com/prebid/prebid-server/v3/openrtb_ext"
)

var validParams = []string{
Expand Down
17 changes: 9 additions & 8 deletions adapters/acuityads/acuityads.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ import (
"text/template"

"github.com/prebid/openrtb/v20/openrtb2"
"github.com/prebid/prebid-server/v2/adapters"
"github.com/prebid/prebid-server/v2/config"
"github.com/prebid/prebid-server/v2/errortypes"
"github.com/prebid/prebid-server/v2/macros"
"github.com/prebid/prebid-server/v2/openrtb_ext"
"github.com/prebid/prebid-server/v3/adapters"
"github.com/prebid/prebid-server/v3/config"
"github.com/prebid/prebid-server/v3/errortypes"
"github.com/prebid/prebid-server/v3/macros"
"github.com/prebid/prebid-server/v3/openrtb_ext"
"github.com/prebid/prebid-server/v3/util/jsonutil"
)

type AcuityAdsAdapter struct {
Expand Down Expand Up @@ -90,13 +91,13 @@ func (a *AcuityAdsAdapter) MakeRequests(

func (a *AcuityAdsAdapter) getImpressionExt(imp *openrtb2.Imp) (*openrtb_ext.ExtAcuityAds, error) {
var bidderExt adapters.ExtImpBidder
if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil {
if err := jsonutil.Unmarshal(imp.Ext, &bidderExt); err != nil {
return nil, &errortypes.BadInput{
Message: "ext.bidder not provided",
}
}
var acuityAdsExt openrtb_ext.ExtAcuityAds
if err := json.Unmarshal(bidderExt.Bidder, &acuityAdsExt); err != nil {
if err := jsonutil.Unmarshal(bidderExt.Bidder, &acuityAdsExt); err != nil {
return nil, &errortypes.BadInput{
Message: "ext.bidder not provided",
}
Expand Down Expand Up @@ -155,7 +156,7 @@ func (a *AcuityAdsAdapter) MakeBids(

responseBody := bidderRawResponse.Body
var bidResp openrtb2.BidResponse
if err := json.Unmarshal(responseBody, &bidResp); err != nil {
if err := jsonutil.Unmarshal(responseBody, &bidResp); err != nil {
return nil, []error{&errortypes.BadServerResponse{
Message: "Bad Server Response",
}}
Expand Down
6 changes: 3 additions & 3 deletions adapters/acuityads/acuityads_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package acuityads
import (
"testing"

"github.com/prebid/prebid-server/v2/adapters/adapterstest"
"github.com/prebid/prebid-server/v2/config"
"github.com/prebid/prebid-server/v2/openrtb_ext"
"github.com/prebid/prebid-server/v3/adapters/adapterstest"
"github.com/prebid/prebid-server/v3/config"
"github.com/prebid/prebid-server/v3/openrtb_ext"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion adapters/acuityads/params_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"encoding/json"
"testing"

"github.com/prebid/prebid-server/v2/openrtb_ext"
"github.com/prebid/prebid-server/v3/openrtb_ext"
)

var validParams = []string{
Expand Down
Loading

0 comments on commit 4eb4dca

Please sign in to comment.