Skip to content
This repository has been archived by the owner on May 30, 2022. It is now read-only.

fix CI issues #406

Merged
merged 4 commits into from
Nov 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 31 additions & 14 deletions .github/workflows/ci-cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
pull_request:
release:
types: [published]
workflow_dispatch:

env:
PACKAGE_NAME: trento
Expand All @@ -19,7 +20,7 @@ env:
REPOSITORY: ${{ github.repository }}

jobs:
test:
test-binary:
runs-on: ubuntu-20.04
services:
postgres:
Expand Down Expand Up @@ -69,21 +70,32 @@ jobs:
run: make fmt-check
- name: frontend lint and coding style check
run: make web-check

test-checks:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
with:
python-version: 3.7
- uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-python-${{ hashFiles('requirements.dev.txt') }}
- name: install python dependencies
run: pip install -r requirements.dev.txt
- name: ansible playbooks and roles lint check
run: |
pip install ansible==4.6.0 ansible-core==2.11.5 ansible-lint==5.1.3 ara==1.5.7
export ANSIBLE_ACTION_PLUGINS=$(python3 -m ara.setup.action_plugins)
ansible-lint -vv -x role-name,risky-shell-pipe,no-tabs -w yaml \
runner/ansible/* runner/ansible/roles/* \
runner/ansible/roles/checks/* runner/ansible/vars/*
- name: trento checks sanity test
run: |
pip install PyYAML
python3 hack/id_checker.py
- name: trento checks ID sanity test
run: python3 hack/id_checker.py

build-static-binary:
runs-on: ubuntu-20.04
needs: test
needs: [test-binary, test-checks]
steps:
- uses: actions/checkout@v2
with:
Expand Down Expand Up @@ -127,6 +139,7 @@ jobs:
needs: build-static-binary
if: (github.event_name == 'push' && github.ref == 'refs/heads/main')
runs-on: "ubuntu-latest"
concurrency: ci-${{ github.ref }}
steps:
- uses: actions/download-artifact@v2
with:
Expand Down Expand Up @@ -163,6 +176,7 @@ jobs:
needs: [ build-and-push-container-images, release-rolling ]
if: (github.event_name == 'push' && github.ref == 'refs/heads/main') || github.event_name == 'workflow_dispatch'
environment: AZURE_DEMO
concurrency: ci-${{ github.ref }}
env:
TRENTO_SERVER_HOST: ${{ secrets.TRENTO_SERVER_HOST }}
TRENTO_USER: ${{ secrets.TRENTO_USER }}
Expand All @@ -185,6 +199,7 @@ jobs:
needs: [ deploy-server ]
if: (github.event_name == 'push' && github.ref == 'refs/heads/main') || github.event_name == 'workflow_dispatch'
environment: AZURE_DEMO
concurrency: ci-${{ github.ref }}
env:
stefanotorresi marked this conversation as resolved.
Show resolved Hide resolved
TRENTO_AGENT_HOSTS: ${{ secrets.TRENTO_AGENT_HOSTS }}
TRENTO_USER: ${{ secrets.TRENTO_USER }}
Expand All @@ -205,22 +220,22 @@ jobs:
done

build-and-push-container-images:
needs: test
needs: [test-binary, test-checks]
if: (github.event_name == 'push' && github.ref == 'refs/heads/main') || github.event_name == 'release' || github.event_name == 'workflow_dispatch'
strategy:
matrix:
image-target:
- trento-web
- trento-runner
env:
REGISTRY: ghcr.io
IMAGE_REPOSITORY: ghcr.io/${{ github.repository_owner }}/${{ matrix.image-target }}
IMAGE_TAG: "${{ github.event_name == 'release' && github.event.release.tag_name || 'rolling' }}"
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

concurrency: ci-${{ github.ref }}
env:
REGISTRY: ghcr.io
IMAGE_REPOSITORY: ghcr.io/${{ github.repository_owner }}/${{ matrix.image-target }}
IMAGE_TAG: "${{ github.event_name == 'release' && github.event.release.tag_name || 'rolling' }}"
steps:
- name: Checkout repository
uses: actions/checkout@v2
Expand Down Expand Up @@ -251,9 +266,10 @@ jobs:
cache-to: type=gha,mode=max

obs-commit:
needs: test
needs: [test-binary, test-checks]
runs-on: ubuntu-18.04
if: github.ref == 'refs/heads/main' || github.event_name == 'release'
concurrency: ci-${{ github.ref }}
container:
image: ghcr.io/trento-project/continuous-delivery:master
env:
Expand Down Expand Up @@ -287,6 +303,7 @@ jobs:
needs: obs-commit
runs-on: ubuntu-18.04
if: github.event.release
concurrency: ci-${{ github.ref }}
container:
image: ghcr.io/trento-project/continuous-delivery:master
steps:
Expand Down
5 changes: 5 additions & 0 deletions requirements.dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ansible==4.6.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea!
Most probably, we could even have a prod requirements file, that is used in runner container creation.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I thought about this! Probably in another PR though.

ansible-core==2.11.5
ansible-lint==5.1.3
ara==1.5.7
PyYAML