-
Notifications
You must be signed in to change notification settings - Fork 167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gitlab throttling + adaptation to gitlab api changes + more logging for troubleshooting #256
base: master
Are you sure you want to change the base?
Changes from all commits
f169b1e
30635f2
3938cba
2257d02
1861c15
6094a43
025bc80
5745862
f0af1d6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,100 +1,44 @@ | ||
name: Build and Release | ||
# This workflow uses actions that are not certified by GitHub. | ||
# They are provided by a third-party and are governed by | ||
# separate terms of service, privacy policy, and support | ||
# documentation. | ||
|
||
# GitHub recommends pinning actions to a commit SHA. | ||
# To get a newer version, you will need to update the SHA. | ||
# You can also reference a tag or branch, but the action may change without warning. | ||
|
||
name: Publish Docker image | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
branches: | ||
- master | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Use Node.js 14.x | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 14.x | ||
|
||
- name: Install grunt-cli | ||
run: npm install -g grunt-cli | ||
|
||
- name: Install local dependencies | ||
run: npm install | ||
|
||
- name: Run CI build | ||
run: npm run-script ci | ||
|
||
release: | ||
if: startsWith(github.ref, 'refs/tags/') | ||
push_to_registry: | ||
name: Push Docker image to Docker Hub | ||
runs-on: ubuntu-latest | ||
needs: build | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Use Node.js 14.x | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 14.x | ||
|
||
- name: Install global dependencies | ||
run: | | ||
npm install -g grunt-cli | ||
npm install -g pkg | ||
|
||
- name: Install local dependencies | ||
run: npm install | ||
|
||
- name: Build Release Package | ||
run: npm run-script pkg | ||
- name: Check out the repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Log in to Docker Hub | ||
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: ${{ github.ref }} | ||
draft: true | ||
prerelease: false | ||
|
||
- name: Upload Release Asset (Linux) | ||
id: upload-release-asset-linux | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./release/node-build-monitor-linux | ||
asset_name: node-build-monitor-linux | ||
asset_content_type: application/octet-stream | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Upload Release Asset (Mac OS) | ||
id: upload-release-asset-macos | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./release/node-build-monitor-macos | ||
asset_name: node-build-monitor-macos | ||
asset_content_type: application/octet-stream | ||
|
||
- name: Upload Release Asset (Windows) | ||
id: upload-release-asset-windows | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
images: | | ||
yaman/node-build-monitor | ||
|
||
- name: Build and push Docker images | ||
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./release/node-build-monitor-win.exe | ||
asset_name: node-build-monitor-win.exe | ||
asset_content_type: application/octet-stream | ||
context: . | ||
push: true | ||
tags: yaman/node-build-monitor:latest | ||
labels: ${{ steps.meta.outputs.labels }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,4 +14,4 @@ ONBUILD ADD config.json /build-mon/app/config.json | |
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please revert all changes in this file. |
||
EXPOSE 3000 | ||
|
||
CMD [ "forever","--watch", "--watchDirectory", "/build-mon/app", "/build-mon/app/app.js"] | ||
CMD [ "forever","--watch", "--watchDirectory", "/build-mon/app", "/build-mon/app/app.js"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -319,9 +319,11 @@ Supports an on-premise [GitLab](http://gitlab.com) Community Edition/Enterprise | |
{ | ||
"name": "GitLab", | ||
"configuration": { | ||
"debug": false, | ||
"url": "http://gitlab.example.com:8080", | ||
"token": "secret_user_token", | ||
"additional_query": "&search=gitlab-org&starred=true", | ||
"main_group" : "your_main_project_group", | ||
"numberOfPipelinesPerProject": 3, | ||
"pipeline": { | ||
"status": ["running", "pending", "success", "failed", "canceled", "skipped"] | ||
|
@@ -338,11 +340,13 @@ Supports an on-premise [GitLab](http://gitlab.com) Community Edition/Enterprise | |
|
||
| Setting | Description | ||
|--------------------|------------------------------------------------------------------------------------------------------------- | ||
| `url` | GitLab server http(s) address string | ||
| `token` | Secret token string for the existing user to be used to authenticate against GitLab REST API | ||
| `slugs` | List of project slugs to display and check for builds. Defaults to `*/*` for all projects you have access to. Use `/*` when specifying group slug to include projects only from current group and `/**` to also include subgroups. Optional 'ref' attribute can be used to specify the branch. | ||
| `debug` | Print all available logs to console. | ||
| `url` | GitLab server http(s) address string. | ||
| `token` | Secret token string for the existing user to be used to authenticate against GitLab REST API. | ||
| `slugs` | List of project slugs to display and check for builds. Defaults to `*/*` for all projects you have .access to. Use `/*` when specifying group slug to include projects only from current group and `/**` to also include subgroups. Optional 'ref' attribute can be used to specify the branch. | ||
| `intervals` | How often (in integer of milliseconds) ... | ||
| `additional_query` | Add [additional query parameters](https://gitlab.com/help/api/projects.md) so not too many projects are fetched. | ||
| `main_group` | Gitlab needs a main group to analyze the project only you want to monitor, otherwise, you will get the whole world. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What happens, if this property is not set? Will existing GitLab configurations crash after an upgrade of the build monitor? |
||
| `numberOfPipelinesPerProject` | Limit the number of pipelines fetched for each project. Optional, defaults to no limitation. | ||
|
||
Because API V4 returns **all** internal and public projects by default, you propably | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -111,6 +111,10 @@ monitor.run(); | |
|
||
// helpers | ||
function tryExpandEnvironmentVariables(monitorConfiguration, serviceConfiguration) { | ||
if (process.env.TOKEN) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please revert this change. This should happen automatically by |
||
serviceConfiguration.token = process.env.TOKEN; | ||
} | ||
|
||
if (monitorConfiguration.expandEnvironmentVariables) { | ||
for (var property in serviceConfiguration) { | ||
serviceConfiguration[property] = tryExpandEnvironmentVariable(serviceConfiguration[property]); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,4 +20,4 @@ | |
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please revert all changes in this file. |
||
} | ||
] | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert all changes in this file.