This repository has been archived by the owner on Nov 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 295
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Store snap travici linux builds in a s3 repository. * Upload build directory to AWS s3. * Update DNS build.ci.snap-telemtry.io -> s3 repo.
- Loading branch information
Showing
6 changed files
with
154 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/bash | ||
|
||
#http://www.apache.org/licenses/LICENSE-2.0.txt | ||
# | ||
# | ||
#Copyright 2016 Intel Corporation | ||
# | ||
#Licensed under the Apache License, Version 2.0 (the "License"); | ||
#you may not use this file except in compliance with the License. | ||
#You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
#Unless required by applicable law or agreed to in writing, software | ||
#distributed under the License is distributed on an "AS IS" BASIS, | ||
#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
#See the License for the specific language governing permissions and | ||
#limitations under the License. | ||
|
||
git_branch=$(git symbolic-ref HEAD 2> /dev/null | cut -b 12-) | ||
git_branch="${git_branch:-snap}" | ||
git_sha=$(git log --pretty=format:"%h" -1) | ||
git_version=$(git describe --always --exact-match 2> /dev/null || echo "${git_branch}-${git_sha}") | ||
|
||
set -e | ||
set -u | ||
set -o pipefail | ||
|
||
__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
__proj_dir="$(dirname "$__dir")" | ||
|
||
# shellcheck source=scripts/common.sh | ||
. "${__dir}/common.sh" | ||
|
||
SNAP_BUILD_URL="https://s3-us-west-2.amazonaws.com/intelsdi-x/snap/${git_version}" | ||
export SNAP_BUILD_URL | ||
|
||
_info "updating package URL: ${SNAP_BUILD_URL}" | ||
go get github.com/dnsimple/dnsimple-go/dnsimple | ||
go run "${__proj_dir}/scripts/update_dns.go" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/bin/bash | ||
|
||
#http://www.apache.org/licenses/LICENSE-2.0.txt | ||
# | ||
# | ||
#Copyright 2016 Intel Corporation | ||
# | ||
#Licensed under the Apache License, Version 2.0 (the "License"); | ||
#you may not use this file except in compliance with the License. | ||
#You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
#Unless required by applicable law or agreed to in writing, software | ||
#distributed under the License is distributed on an "AS IS" BASIS, | ||
#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
#See the License for the specific language governing permissions and | ||
#limitations under the License. | ||
|
||
git_branch=$(git symbolic-ref HEAD 2> /dev/null | cut -b 12-) | ||
git_branch="${git_branch:-snap}" | ||
git_sha=$(git log --pretty=format:"%h" -1) | ||
git_version=$(git describe --always --exact-match 2> /dev/null || echo "${git_branch}-${git_sha}") | ||
|
||
set -e | ||
set -u | ||
set -o pipefail | ||
|
||
__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
__proj_dir="$(dirname "$__dir")" | ||
|
||
# shellcheck source=scripts/common.sh | ||
. "${__dir}/common.sh" | ||
|
||
build_path="${SNAP_PATH:-"${__proj_dir}/build"}" | ||
git_path="${build_path}/${git_version}" | ||
|
||
mkdir -p "${git_path}" | ||
_info "copying snap binaries to ${git_path}" | ||
mv "${build_path}/bin/"* "${git_path}" | ||
mv "${build_path}/plugin/"* "${git_path}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"strconv" | ||
|
||
"github.com/dnsimple/dnsimple-go/dnsimple" | ||
) | ||
|
||
func main() { | ||
url := os.Getenv("SNAP_BUILD_URL") | ||
if len(url) == 0 { | ||
fmt.Printf("Must provide SNAP_BUILD_URL") | ||
os.Exit(1) | ||
} | ||
|
||
oauthToken := os.Getenv("DNSIMPLE_TOKEN") | ||
if len(oauthToken) == 0 { | ||
fmt.Printf("Must provide DNSIMPLE_TOKEN") | ||
os.Exit(1) | ||
} | ||
|
||
client := dnsimple.NewClient(dnsimple.NewOauthTokenCredentials(oauthToken)) | ||
|
||
// get DNSimple client accountID | ||
whoamiResponse, err := client.Identity.Whoami() | ||
if err != nil { | ||
fmt.Printf("Whoami() returned error: %v\n", err) | ||
os.Exit(1) | ||
} | ||
accountID := strconv.Itoa(whoamiResponse.Data.Account.ID) | ||
zoneID := "snap-telemetry.io" | ||
|
||
result, err := client.Zones.ListRecords(accountID, zoneID, &dnsimple.ZoneRecordListOptions{Name: "build.ci"}) | ||
if err != nil { | ||
fmt.Printf("build.ci.snap-telemetry.io DNS record not found: %v\n", err) | ||
os.Exit(1) | ||
} | ||
|
||
record := result.Data[0] | ||
|
||
// replace build.ci.snap-telemtry.io URL record with new s3 folder | ||
record.Content = url | ||
client.Zones.UpdateRecord(accountID, zoneID, record.ID, record) | ||
} |