mirror of
https://github.com/k8snetworkplumbingwg/multus-cni.git
synced 2025-09-22 18:07:19 +00:00
Merge remote-tracking branch 'origin/develop' into dev/add_if_name
This commit is contained in:
30
.travis.yml
Normal file
30
.travis.yml
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
language: go
|
||||||
|
# see https://docs.travis-ci.com/user/reference/overview/#Virtualization-environments
|
||||||
|
# for the detail
|
||||||
|
# sudo: requried
|
||||||
|
dist: trusty
|
||||||
|
|
||||||
|
before_install:
|
||||||
|
- sudo apt-get update -qq
|
||||||
|
|
||||||
|
#install:
|
||||||
|
# - go get .
|
||||||
|
# - go get github.com/golang/lint/golint
|
||||||
|
|
||||||
|
#before_script:
|
||||||
|
# - go vet .
|
||||||
|
# - golint . | xargs -r false
|
||||||
|
|
||||||
|
script:
|
||||||
|
- ./build
|
||||||
|
- mkdir -p ${TRAVIS_BUILD_DIR}/dist
|
||||||
|
- tar cvfz ${TRAVIS_BUILD_DIR}/dist/multus-cni_amd64.tar.gz --warning=no-file-changed --exclude="dist" --exclude="vendor" .
|
||||||
|
|
||||||
|
after_success:
|
||||||
|
# put build tgz to bintray
|
||||||
|
- curl -T ${TRAVIS_BUILD_DIR}/dist/multus-cni_amd64.tar.gz -u${BINTRAY_USER}:${BINTRAY_APIKEY} https://api.bintray.com/content/redhat-nfvpe/multus-cni-crd-snapshots/snapshot/snapshot-${TRAVIS_COMMIT}/multus-cni_amd64-${TRAVIS_COMMIT}.tar.gz
|
||||||
|
# publish uploaded file
|
||||||
|
- curl -X POST -u${BINTRAY_USER}:${BINTRAY_APIKEY} https://api.bintray.com/content/redhat-nfvpe/multus-cni-crd-snapshots/snapshot/snapshot-${TRAVIS_COMMIT}/publish
|
||||||
|
# put it in bintray download list
|
||||||
|
- sleep 20
|
||||||
|
- "curl -X PUT -H 'Accept: application/json' -H 'Content-type: application/json' -u${BINTRAY_USER}:${BINTRAY_APIKEY} https://api.bintray.com/file_metadata/redhat-nfvpe/multus-cni-crd-snapshots/multus-cni_amd64-${TRAVIS_COMMIT}.tar.gz -d '{\"list_in_downloads\":true}'"
|
@@ -304,21 +304,15 @@ func parsePodNetworkObject(podnetwork string) ([]map[string]interface{}, error)
|
|||||||
return nil, fmt.Errorf("parsePodNetworkObject: pod annotation not having \"network\" as key, refer Multus README.md for the usage guide")
|
return nil, fmt.Errorf("parsePodNetworkObject: pod annotation not having \"network\" as key, refer Multus README.md for the usage guide")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Parse the podnetwork string, and assume it is JSON.
|
||||||
// Determine if the string is JSON format, or comma-delimited.
|
if err := json.Unmarshal([]byte(podnetwork), &podNet); err != nil {
|
||||||
if (isJSON(podnetwork)) {
|
// If the JSON parsing fails, assume it is comma delimited.
|
||||||
// Use the JSON as-is
|
|
||||||
if err := json.Unmarshal([]byte(podnetwork), &podNet); err != nil {
|
|
||||||
return nil, fmt.Errorf("parsePodNetworkObject: failed to load pod network err: %v | pod network: %v", err, podnetwork)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Build a map from the comma delimited items.
|
|
||||||
commaItems := strings.Split(podnetwork, ",")
|
commaItems := strings.Split(podnetwork, ",")
|
||||||
|
// Build a map from the comma delimited items.
|
||||||
for i := range commaItems {
|
for i := range commaItems {
|
||||||
netName := strings.TrimSpace(commaItems[i])
|
atItems := strings.Split(commaItems[i], "@")
|
||||||
atItems := strings.Split(netName, "@")
|
|
||||||
m := make(map[string]interface{})
|
m := make(map[string]interface{})
|
||||||
m["name"] = atItems[0]
|
m["name"] = strings.TrimSpace(atItems[0])
|
||||||
if len(atItems) == 2 {
|
if len(atItems) == 2 {
|
||||||
m["interfaceRequest"] = atItems[1]
|
m["interfaceRequest"] = atItems[1]
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user