This webhook listener awaits webhook notifications from CircleCI, when a notification is received it downloads the files from CircleCI's artifacts folder.
- clone repository
- navigate to root of repository
- run "npm install"
- navigate to root of repository
- setup CircleCI
- setup settings.json
- run "npm start"
- navigate to root of repository
- run "npm test"
in your circle.yml file add the following lines
notify:
webhooks:
- url: {yourWebHookAddress}:{portWebHookListener}/webhook
in your circle.yml file write a copy command for all the files that need to be downloaded, to the $CIRCLE_ARTIFACTS directory, after the lines that build your project. For example an android project:
test:
override:
- ./gradlew build
- cp -r app/build/outputs/apk $CIRCLE_ARTIFACTS
note: circle.yml only takes 2 spaces, not tabs
This is where you place your API token, this can be obtained by going to circleci -> project settings -> API permissions (if needed-> click "Create Token") "circle_ci_token": "ABCDEFGHIJKLMNOPQRTSUVWXY123"
This is the URL of your circleCI project, it should have this format,
"circle_ci_url": "https://circleci.com/api/v1.1/project/{VCS}/{TEAM_NAME}/{PROJECT_NAME}/.
- VCS is the Version Control System used for this project, can either be "github" or "bitbucket"
- TEAM_NAME is the name of the team this project was created under on CircleCI.
- PROJECT_NAME is the name of the project on CircleCI.
TEAM_NAME and PROJECT_NAME can be found when browsing to your project on CircleCI and looking at the url, it should a format like this: "https://circleci.com/gh/{TEAM_NAME}/{PROJECT_NAME}"
This is the hostname the webhook listener will listen to, if null or not present it will listen to all addresses on the given port.
This is the port that the webhook listener will listen to, this is the same port that you have to enter in the circle.yml file in the line {yourWebHookAddress}:{thisPort}/webhook
This is the path the webhook listener will download the obtained artifacts to. You can use "{cwd}", this will be replaced with the root directory of the webhook listener project, for example:
"download_path": "{cwd}/downloads/"
"download_path": "C:\\Users\\ThimoVSS\\circleCIArtifacts"
example with codeship:
Setup environment to have $BOTNAME and $TARGETHOST in environment variables
npm pack
PACKAGE=`ls circleci_webhook_listener-*.tgz`
REMOTE_EXEC="ssh $BOTNAME@$TARGETHOST -C"
scp $PACKAGE $BOTNAME@$TARGETHOST:apps/circleci_webhook_listener/releases/
$REMOTE_EXEC mkdir -p apps/circleci_webhook_listener/releases/ apps/circleci_webhook_listener/current apps/circleci_webhook_listener/shared
$REMOTE_EXEC "cd apps/circleci_webhook_listener/current; cnpm install --production ../releases/$PACKAGE"
$REMOTE_EXEC "cd apps/circleci_webhook_listener/current; ln -sf ../shared/settings.json"
use: