-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d2f0a30
commit b9206c7
Showing
10 changed files
with
136 additions
and
32 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.git | ||
node_modules/ | ||
packages/ |
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,8 @@ | ||
FROM node:13.8.0-stretch | ||
WORKDIR /app | ||
COPY package*.json ./ | ||
|
||
RUN npm ci | ||
|
||
COPY . . | ||
ENTRYPOINT ["node", "index.js"] |
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 |
---|---|---|
@@ -1,17 +1,26 @@ | ||
const path = require("path"); | ||
const { canIDeploy } = require("./canIDeploy"); | ||
const { canIDeploy, getPacticipants } = require("./canIDeploy"); | ||
|
||
jest.setTimeout(60000); | ||
describe("canIDeploy", () => { | ||
test("canIDeploy", async () => { | ||
test("canIDeploy pacticipant test", async () => { | ||
const filePath = path.resolve( | ||
__dirname, | ||
"./__tests__/deploy-kustomization.yaml" | ||
); | ||
await canIDeploy({ | ||
let result = getPacticipants({ | ||
kustomizeFile: filePath, | ||
retryTimes: 1, | ||
retryInterval: 10 | ||
serviceNames: ["frontend", "gateway"] | ||
}); | ||
expect(result.map(a => a.name)).toEqual( | ||
expect.arrayContaining(["Frontend", "Gateway"]) | ||
); | ||
result = getPacticipants({ | ||
kustomizeFile: filePath, | ||
serviceNames: ["frontend", "gateway", "auth-service"] | ||
}); | ||
expect(result.map(a => a.name)).toEqual( | ||
expect.arrayContaining(["Frontend", "Gateway", "AuthService"]) | ||
); | ||
}); | ||
}); |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -3,12 +3,18 @@ | |
"version": "0.1.0", | ||
"description": "", | ||
"main": "index.js", | ||
"bin": "index.js", | ||
"scripts": { | ||
"pretest": "KUBECONFIG=./config.yaml kind create cluster", | ||
"test": "jest || :", | ||
"test:watch": "jest --watch || :", | ||
"posttest": "rm ./config.yaml && KUBECONFIG=./config.yaml kind delete cluster", | ||
"package": "pkg -t node10-macos-x64,node10-linux-x64 -o=packages/utils index.js" | ||
"package": "pkg -t node10-macos-x64,node10-linux-x64 -o=packages/utils ." | ||
}, | ||
"pkg": { | ||
"assets": [ | ||
"node_modules/@pact-foundation/pact-node/standalone/**/*" | ||
] | ||
}, | ||
"keywords": [], | ||
"author": "Suraj Keshri <[email protected]>", | ||
|
@@ -24,6 +30,7 @@ | |
"yargs": "^15.1.0" | ||
}, | ||
"devDependencies": { | ||
"@types/jest": "^25.1.3", | ||
"eslint": "^6.8.0", | ||
"jest": "^25.1.0", | ||
"jest-watch-typeahead": "^0.4.2", | ||
|
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,36 @@ | ||
### To trigger remote build of a pipeline with trigger parameters: | ||
|
||
1. Define parameters in the pipeline project: | ||
|
||
```groovy | ||
pipeline { | ||
agent any | ||
parameters { | ||
string(name: 'TRIGGER_PARAM', defaultValue: '', description: 'trigger param description') | ||
} | ||
} | ||
``` | ||
|
||
2. create token from here: http://myjenkins:8080/user/surajkeshri/configure | ||
|
||
``` | ||
http://[USERNAME]:[TOKEN]@myjenkins:8080/job/[pipeline-project-name]/job/[branch]/buildWithParameters?TRIGGER_PARAM=yo | ||
``` | ||
|
||
### To trigger remote build of a pipeline without params: | ||
|
||
1. Step 1 without paramters | ||
2. Same as step 2 | ||
3. Trigger: | ||
|
||
``` | ||
http://[USERNAME]:[TOKEN]@myjenkins:8080/job/[pipeline-project-name]/job/[branch]/build | ||
``` | ||
|
||
pact-broker create-webhook http://myjenkins:8080/job/auth-service/job/master/buildWithParameters?PACT_VERIFY=true --request=POST --broker-base-url=\${BROKER_BASE_URL} | ||
|
||
pact-broker create-webhook \ | ||
http://myjenkins:8080/job/test/buildWithParameters?PACT_VERIFY=true \ | ||
--request=POST --contract-content-changed \ | ||
--provider=AuthService --user=surajkeshri:11d68c6558003716571dd8f4a9b544b76b \ | ||
--broker-base-url=$PACT_BROKER_URL --broker-token=$PACT_BROKER_TOKEN |