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

Release OpenWrap_TBD #608

Closed
wants to merge 12 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .github/workflows/adapter-code-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ jobs:
id: run_coverage
if: ${{ steps.get_directories.outputs.result }} != ""
run: |
git config --global url."https://${USERNAME}:${TOKEN}@git.pubmatic.com".insteadOf "https://git.pubmatic.com"

directories=$(echo '${{ steps.get_directories.outputs.result }}' | jq -r '.[]')
go mod download

Expand All @@ -65,13 +67,18 @@ jobs:
# remove pull request branch files
cd ..
rm -f -r ./*
env:
GO111MODULE: "on"
GOPRIVATE: "git.pubmatic.com/PubMatic/*"
TOKEN: ${{ secrets.PM_OPENWRAP_CICD_PASSWORD }}
USERNAME: ${{ secrets.PM_OPENWRAP_CICD_USERNAME }}

- name: Checkout coverage-preview branch
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: coverage-preview
repository: prebid/prebid-server
repository: PubMatic-OpenWrap/prebid-server

- name: Commit coverage files to coverage-preview branch
if: ${{ steps.run_coverage.outputs.coverage_dir }} != ""
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cross-repo-issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
pull_request_target:
types: [closed]
branches:
- "master"
- "master-disable"

jobs:
cross-repo:
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/validate-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ name: Validate Merge

on:
pull_request:
branches: [master]
branches:
- master
- main
- ci

jobs:
validate-merge:
Expand Down
52 changes: 30 additions & 22 deletions adapters/vastbidder/bidder_macro.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"encoding/json"
"fmt"
"net/http"
"net/url"
"strconv"
"strings"
"time"
Expand Down Expand Up @@ -177,16 +176,35 @@ func (tag *BidderMacro) GetHeaders() http.Header {
return http.Header{}
}

// GetValueFromKV returns the value from KV map wrt key
func (tag *BidderMacro) GetValueFromKV(key string) string {
if tag.KV == nil {
return ""
}
key = strings.TrimPrefix(key, kvPrefix)
if value, found := tag.KV[key]; found {
return fmt.Sprintf("%v", value)
// GetValue returns the value for given key
// isKeyFound will check the key is present or not
func (tag *BidderMacro) GetValue(key string) (string, bool) {
macroKeys := strings.Split(key, ".")
isKeyFound := false

// This will check if key has prefix kv/kvm
// if prefix present it will always return isKeyFound as true as it will help to replace the key with empty string in VAST TAG
if (macroKeys[0] == MacroKV || macroKeys[0] == MacroKVM) && len(macroKeys) > 1 {
isKeyFound = true
if tag.KV == nil {
return "", isKeyFound
}
switch macroKeys[0] {
case MacroKV:
val := getValueFromMap(macroKeys[1:], tag.KV)
if dataMap, ok := val.(map[string]interface{}); ok {
return mapToQuery(dataMap), isKeyFound
}
return fmt.Sprintf("%v", val), isKeyFound
case MacroKVM:
val := getValueFromMap(macroKeys[1:], tag.KV)
if isMap(val) {
return getJSONString(val), isKeyFound
}
return fmt.Sprintf("%v", val), isKeyFound
}
}
return ""
return "", isKeyFound
}

/********************* Request *********************/
Expand Down Expand Up @@ -1209,25 +1227,15 @@ func (tag *BidderMacro) MacroKV(key string) string {
if tag.KV == nil {
return ""
}

values := url.Values{}
for key, val := range tag.KV {
values.Add(key, fmt.Sprintf("%v", val))
}
return values.Encode()

return mapToQuery(tag.KV)
}

// MacroKVM replace the kvm macro
func (tag *BidderMacro) MacroKVM(key string) string {
if tag.KV == nil {
return ""
}
jsonBytes, err := json.Marshal(tag.KV)
if err != nil {
return ""
}
return string(jsonBytes)
return getJSONString(tag.KV)
}

/********************* Request Headers *********************/
Expand Down
Loading
Loading