Skip to content

Commit b85facf

Browse files
authored
[PLATFORM-2869] Fix publish step (#27)
* Update circleci workflow * Fix publish step
1 parent c876d4e commit b85facf

File tree

12 files changed

+98
-77
lines changed

12 files changed

+98
-77
lines changed

.circleci/config.yml

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,34 +23,25 @@ jobs:
2323
root: .
2424
paths: [.]
2525

26-
conventions:
26+
test_phantomjs:
2727
docker:
2828
- image: ${AWS_ACCOUNT_ID}.dkr.ecr.us-west-2.amazonaws.com/analytics.js-integrations-ci
2929
steps:
3030
- attach_workspace: { at: . }
3131
- restore_cache:
3232
key: deps-{{ checksum "yarn.lock" }}
33-
- run:
34-
name: Authenticate npm
35-
command: npm config set "//registry.npmjs.org/:_authToken" $NPM_AUTH
3633
- run:
3734
name: Linter
3835
command: yarn lint
36+
- run:
37+
name: Test updated integrations in PhantomJS
38+
command: yarn test-integrations --browsers PhantomJS
3939
- store_artifacts:
4040
path: coverage
4141
- run:
4242
name: Coverage
4343
command: yarn coverage
44-
test_phantomjs:
45-
docker:
46-
- image: ${AWS_ACCOUNT_ID}.dkr.ecr.us-west-2.amazonaws.com/analytics.js-integrations-ci
47-
steps:
48-
- attach_workspace: { at: . }
49-
- restore_cache:
50-
key: deps-{{ checksum "yarn.lock" }}
51-
- run:
52-
name: Test updated integrations in PhantomJS
53-
command: yarn test-integrations --browsers PhantomJS
44+
5445
# TODO: Currently we just have 2 concurrent sessions in SauceLabs, but each step should
5546
# test one browser type.
5647
test_chrome_firefox_safari:
@@ -94,18 +85,15 @@ workflows:
9485
test_and_publish:
9586
jobs:
9687
- setup
97-
- conventions:
98-
requires:
99-
- setup
10088
- test_phantomjs:
10189
requires:
102-
- conventions
90+
- setup
10391
- test_chrome_firefox_safari:
10492
requires:
105-
- conventions
93+
- setup
10694
- test_ie_edge:
10795
requires:
108-
- conventions
96+
- setup
10997
- publish:
11098
requires:
11199
- test_phantomjs

operations/cmd/archive-integration-repository/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func init() {
2121

2222
func main() {
2323

24-
operations.GetAuthToken()
24+
operations.GetGitHubAuthToken()
2525

2626
flag.Parse()
2727
if integrationName == "" {

operations/cmd/boneyard-integration-repository/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ func init() {
2222

2323
func main() {
2424

25-
operations.GetAuthToken()
25+
operations.GetGitHubAuthToken()
2626

2727
flag.Parse()
2828
if integrationName == "" {

operations/cmd/list-new-releases/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ func main() {
2929
os.Exit(1)
3030
}
3131

32-
npm := &operations.NPM{}
32+
yarn := operations.NewYarnClient()
3333

3434
for _, integration := range integrations {
35-
latestPublished, err := npm.GetLatestVersion(integration.Package.Name)
35+
latestPublished, err := yarn.GetLatestVersion(integration.Package.Name)
3636
if err != nil {
3737
if err != operations.ErrPackageNotFound {
3838
os.Exit(1)

operations/cmd/list-repositories/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func init() {
2121

2222
func main() {
2323

24-
operations.GetAuthToken()
24+
operations.GetGitHubAuthToken()
2525

2626
flag.Parse()
2727
github := operations.NewGitHubClient()

operations/cmd/migrate-integration/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ func init() {
2323

2424
func main() {
2525

26-
operations.GetAuthToken()
26+
operations.GetGitHubAuthToken()
2727

2828
flag.Parse()
2929
if integrationName == "" {

operations/git.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ func printMessage(msg string) git.ErrorCode {
1616
// credentialsCallback returns the default credentials
1717
func credentialsCallback(url, username string, t git.CredType) (git.ErrorCode, *git.Cred) {
1818
Debug("Credentials called, type %d (%s, %s)", t, url, username)
19-
ret, cred := git.NewCredUserpassPlaintext(GetAuthToken(), "x-oauth-basic")
19+
ret, cred := git.NewCredUserpassPlaintext(GetGitHubAuthToken(), "x-oauth-basic")
2020
Debug("Credentials returned, errorCode %d, type %d, hasUsername %t", ret, cred.Type(), cred.HasUsername())
2121
return git.ErrOk, &cred
2222
}

operations/github.go

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"errors"
66
"fmt"
7+
"os"
78
"strings"
89
"time"
910

@@ -12,6 +13,8 @@ import (
1213
"golang.org/x/oauth2"
1314
)
1415

16+
const gitHubAuthvar = "GITHUB_TOKEN"
17+
1518
// Look away, I'm hideous! - KramerQL
1619

1720
// GitHub is a convenient wrapper for the GraphQL client
@@ -72,7 +75,7 @@ type PullRequest struct {
7275
// GitHub's V4 API.
7376
func NewGitHubClient() *GitHub {
7477
src := oauth2.StaticTokenSource(
75-
&oauth2.Token{AccessToken: GetAuthToken()},
78+
&oauth2.Token{AccessToken: GetGitHubAuthToken()},
7679
)
7780
httpClient := oauth2.NewClient(context.Background(), src)
7881

@@ -622,3 +625,14 @@ func (g *GitHub) Transfer(project Project, organization string) error {
622625

623626
return nil
624627
}
628+
629+
// GetGitHubAuthToken returns the authentication token if found, if not, it exist the
630+
// app.
631+
func GetGitHubAuthToken() string {
632+
token := os.Getenv(gitHubAuthvar)
633+
if token == "" {
634+
Log("Please export $%s with a personal token and try again. Exiting", gitHubAuthvar)
635+
os.Exit(1)
636+
}
637+
return token
638+
}

operations/npm.go

Lines changed: 0 additions & 35 deletions
This file was deleted.

operations/utils.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ import (
1212
"github.com/blang/semver"
1313
)
1414

15-
const authvar = "GITHUB_TOKEN"
16-
1715
// Verbose prints some extra info
1816
var Verbose = false
1917

@@ -99,17 +97,6 @@ func executeTemplate(tmpl *template.Template, data interface{}) string {
9997
return buffer.String()
10098
}
10199

102-
// GetAuthToken returns the authentication token if found, if not, it exist the
103-
// app.
104-
func GetAuthToken() string {
105-
token := os.Getenv(authvar)
106-
if token == "" {
107-
Log("Please export $%s with a personal token and try again. Exiting", authvar)
108-
os.Exit(1)
109-
}
110-
return token
111-
}
112-
113100
func fileExists(file string) (bool, error) {
114101
if _, err := os.Stat(file); err != nil {
115102
if os.IsNotExist(err) {

0 commit comments

Comments
 (0)