-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The application collects metrics from Tekton using a Rest API and provides a prometheus /metrics endpoint. JIRA: ISV-1691
- Loading branch information
0 parents
commit 1c2b0a8
Showing
28 changed files
with
1,059 additions
and
0 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,44 @@ | ||
--- | ||
name: Build | ||
|
||
on: # yamllint disable-line rule:truthy | ||
workflow_run: | ||
workflows: | ||
- validation | ||
branches: | ||
- ISV-1691 | ||
types: | ||
- completed | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
name: Build and push image | ||
runs-on: ubuntu-latest | ||
|
||
if: ${{ github.event.workflow_run.conclusion == 'success' }} | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Build Image | ||
id: build-image | ||
uses: redhat-actions/buildah-build@v2 | ||
with: | ||
image: pipeline-metrics | ||
tags: latest ${{ github.sha }} | ||
dockerfiles: | | ||
./Dockerfile | ||
- name: Push To quay.io | ||
id: push-to-quay | ||
uses: redhat-actions/push-to-registry@v2 | ||
with: | ||
image: ${{ steps.build-image.outputs.image }} | ||
tags: ${{ steps.build-image.outputs.tags }} | ||
registry: quay.io/redhat-isv | ||
username: ${{ secrets.REGISTRY_USERNAME }} | ||
password: ${{ secrets.REGISTRY_PASSWORD }} | ||
|
||
- name: Print image url | ||
run: echo "Image pushed to ${{ steps.push-to-quay.outputs.registry-paths }}" |
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,104 @@ | ||
--- | ||
name: Deployment | ||
|
||
on: # yamllint disable-line rule:truthy | ||
workflow_run: | ||
workflows: | ||
- Build | ||
branches: | ||
- ISV-1691 | ||
types: | ||
- completed | ||
# push: | ||
# branches: | ||
# - ISV-1691 | ||
workflow_dispatch: | ||
|
||
jobs: | ||
deploy-nonprod: | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }} | ||
environment: | ||
name: nonprod | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Install dependencies | ||
run: | | ||
echo "$SHORT_SHA" | ||
pip install --user openshift | ||
- name: Deploy nonprod environment | ||
uses: dawidd6/action-ansible-playbook@v2 | ||
with: | ||
playbook: playbooks/deploy.yaml | ||
directory: ./ansible | ||
requirements: playbooks/requirements.yaml | ||
vault_password: ${{secrets.VAULT_PASSWORD}} | ||
options: | | ||
--inventory inventory/pipeline-metrics | ||
--extra-vars "env=nonprod pipeline_metrics_image_tag=${{ github.sha }} suffix=${{ github.sha }}" | ||
--verbose | ||
deploy-prod: | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }} | ||
needs: | ||
- deploy-nonprod | ||
environment: | ||
name: prod | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Install dependencies | ||
run: | | ||
pip install --user openshift | ||
- name: Deploy nonprod environment | ||
uses: dawidd6/action-ansible-playbook@v2 | ||
with: | ||
playbook: playbooks/deploy.yaml | ||
directory: ./ansible | ||
requirements: playbooks/requirements.yaml | ||
vault_password: ${{secrets.VAULT_PASSWORD}} | ||
options: | | ||
--inventory inventory/pipeline-metrics | ||
--extra-vars "env=prod pipeline_metrics_image_tag=${{ github.sha }} suffix=${{ github.sha }}" | ||
--verbose | ||
release: | ||
name: Github release | ||
runs-on: ubuntu-latest | ||
needs: | ||
- deploy-prod | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Bump version and push tag | ||
id: tag_version | ||
uses: mathieudutour/github-tag-action@v5.6 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Create a GitHub release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ steps.tag_version.outputs.new_tag }} | ||
release_name: Release ${{ steps.tag_version.outputs.new_tag }} | ||
body: ${{ steps.tag_version.outputs.changelog }} | ||
|
||
- name: Log in to Quay.io | ||
uses: redhat-actions/podman-login@v1 | ||
with: | ||
username: ${{ secrets.REGISTRY_USERNAME }} | ||
password: ${{ secrets.REGISTRY_PASSWORD }} | ||
registry: quay.io | ||
|
||
- name: Tag image with a release tag | ||
run: | | ||
podman pull quay.io/redhat-isv/pipeline-metrics:${{ github.sha }} | ||
podman tag quay.io/redhat-isv/pipeline-metrics:${{ github.sha }} quay.io/redhat-isv/pipeline-metrics:released | ||
podman tag quay.io/redhat-isv/pipeline-metrics:${{ github.sha }} quay.io/redhat-isv/pipeline-metrics:${{ steps.tag_version.outputs.new_tag }} | ||
podman push quay.io/redhat-isv/pipeline-metrics:released | ||
podman push quay.io/redhat-isv/pipeline-metrics:${{ steps.tag_version.outputs.new_tag }} |
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,26 @@ | ||
--- | ||
name: validation | ||
|
||
on: # yamllint disable-line rule:truthy | ||
pull_request: | ||
push: | ||
branches: | ||
- ISV-1691 | ||
workflow_dispatch: | ||
|
||
jobs: | ||
yaml-lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: yaml-lint | ||
uses: ibiqlik/action-yamllint@v3 | ||
|
||
tox: | ||
name: Run unit tests and linters | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: fedora-python/tox-github-action@v0.4 | ||
with: | ||
tox_env: mypy,black,pylint,yamllint,bandit,safety |
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,141 @@ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
pip-wheel-metadata/ | ||
share/python-wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.nox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
*.log.* | ||
local_settings.py | ||
db.sqlite3 | ||
db.sqlite3-journal | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# IPython | ||
profile_default/ | ||
ipython_config.py | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# pipenv | ||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. | ||
# However, in case of collaboration, if having platform-specific dependencies or dependencies | ||
# having no cross-platform support, pipenv may install dependencies that don't work, or not | ||
# install all needed dependencies. | ||
#Pipfile.lock | ||
|
||
# celery beat schedule file | ||
celerybeat-schedule | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ | ||
.dmypy.json | ||
dmypy.json | ||
|
||
# Pyre type checker | ||
.pyre/ | ||
|
||
# VSCode project settings | ||
.vscode/ | ||
|
||
# PyCharm project settings | ||
.idea/ | ||
|
||
# Ansible vault key | ||
.vault_pass | ||
ansible/vault-password | ||
ansible/vault_password | ||
|
||
# For local development | ||
.env | ||
.set_env | ||
secrets |
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,11 @@ | ||
--- | ||
extends: default | ||
|
||
ignore: | | ||
ansible/vaults | ||
|
||
|
||
rules: | ||
line-length: | ||
level: warning | ||
max: 160 |
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,31 @@ | ||
FROM registry.fedoraproject.org/fedora:34 | ||
|
||
LABEL description="Tekton metrics collector" | ||
LABEL summary="A service that collects a metrics form Tekton pipelines." | ||
|
||
ARG USER_UID=1000 | ||
|
||
USER root | ||
|
||
RUN dnf update -y && \ | ||
dnf install -y \ | ||
gcc \ | ||
git \ | ||
openssl-devel \ | ||
pip \ | ||
python3-devel && \ | ||
dnf clean all | ||
|
||
RUN useradd -ms /bin/bash -u "${USER_UID}" user | ||
WORKDIR /home/user | ||
|
||
COPY requirements.txt setup.py ./ | ||
COPY ./metrics ./metrics | ||
|
||
RUN pip3 install -r requirements.txt | ||
RUN python3 setup.py install -O1 --skip-build | ||
|
||
|
||
USER "${USER_UID}" | ||
|
||
ENTRYPOINT [ "metrics" ] |
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,2 @@ | ||
[defaults] | ||
roles_path = ./roles |
Oops, something went wrong.