[WIFI-7439] Add: CI/CD related files

Signed-off-by: Dmitry Dunaev <dmitry@opsfleet.com>
This commit is contained in:
Dmitry Dunaev
2022-03-24 16:19:12 +03:00
parent 7fe38bf226
commit 88346aa0b4
23 changed files with 914 additions and 5 deletions

81
.github/workflows/ci.yml vendored Normal file
View File

@@ -0,0 +1,81 @@
name: CI
on:
push:
paths-ignore:
- 'openapi/**'
- '**.md'
branches:
- main
- 'release/*'
tags:
- 'v*'
pull_request:
branches:
- main
defaults:
run:
shell: bash
jobs:
docker:
runs-on: ubuntu-20.04
env:
DOCKER_REGISTRY_URL: tip-tip-wlan-cloud-ucentral.jfrog.io
DOCKER_REGISTRY_USERNAME: ucentral
steps:
- name: Checkout actions repo
uses: actions/checkout@v2
with:
repository: Telecominfraproject/.github
path: github
- name: Build and push Docker image
uses: ./github/composite-actions/docker-image-build
with:
image_name: owanalytics
registry: tip-tip-wlan-cloud-ucentral.jfrog.io
registry_user: ucentral
registry_password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
# TODO uncomment this when this service is ready for deployment to reduce Slack noise
# - name: Notify on failure via Slack
# if: failure() && github.ref == 'refs/heads/main'
# uses: rtCamp/action-slack-notify@v2
# env:
# SLACK_USERNAME: GitHub Actions failure notifier
# SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
# SLACK_COLOR: "${{ job.status }}"
# SLACK_ICON: https://raw.githubusercontent.com/quintessence/slack-icons/master/images/github-logo-slack-icon.png
# TODO uncomment this when this service is added into docker-compose and helm deployment scripts in wlan-testing
# trigger-testing:
# if: startsWith(github.ref, 'refs/pull/')
# runs-on: ubuntu-latest
# needs: docker
# steps:
# - name: Get base branch name and set as output
# id: get_base_branch
# run: |
# echo ::set-output name=branch::$(echo ${GITHUB_BASE_REF##*/})
# echo ::set-output name=owgw_branch::$(echo ${GITHUB_BASE_REF##*/} | sed 's/main/master/g')
#
# - name: Checkout actions repo
# uses: actions/checkout@v2
# with:
# repository: Telecominfraproject/.github
# path: github
#
# - name: Trigger testing of OpenWifi Docker Compose deployment and wait for result
# uses: ./github/composite-actions/trigger-workflow-and-wait
# env:
# BASE_BRANCH: ${{ steps.get_base_branch.outputs.branch }}
# OWGW_BASE_BRANCH: ${{ steps.get_base_branch.outputs.owgw_branch }}
# with:
# owner: Telecominfraproject
# repo: wlan-testing
# workflow: ow_docker-compose.yml
# token: ${{ secrets.WLAN_TESTING_PAT }}
# ref: master
# inputs: '{"microservice": "all", "deployment_version": "${{ env.BASE_BRANCH }}", "owgw_version": "${{ env.OWGW_BASE_BRANCH }}", "owgwui_version": "${{ env.BASE_BRANCH }}", "owsec_version": "${{ env.BASE_BRANCH }}", "owfms_version": "${{ env.BASE_BRANCH }}", "owprov_version": "${{ env.BASE_BRANCH }}", "owprovui_version": "${{ env.BASE_BRANCH }}", "owanalytics_version": "${{ github.sha }}"}'

19
.github/workflows/cleanup.yml vendored Normal file
View File

@@ -0,0 +1,19 @@
name: Clean up PR Docker images
on:
pull_request:
branches:
- main
types: [ closed ]
defaults:
run:
shell: bash
jobs:
cleanup:
runs-on: ubuntu-latest
steps:
- run: |
export PR_BRANCH_TAG=$(echo ${GITHUB_HEAD_REF#refs/heads/} | tr '/' '-')
curl -uucentral:${{ secrets.DOCKER_REGISTRY_PASSWORD }} -X DELETE "https://tip.jfrog.io/artifactory/tip-wlan-cloud-ucentral/owanalytics/$PR_BRANCH_TAG"

View File

@@ -0,0 +1,24 @@
name: Ensure Jira issue is linked
on:
pull_request:
types: [opened, edited, reopened, synchronize]
branches:
- 'release/*'
jobs:
check_for_issue_key:
runs-on: ubuntu-latest
steps:
- name: Checkout actions repo
uses: actions/checkout@v2
with:
repository: Telecominfraproject/.github
path: github
- name: Run JIRA check
uses: ./github/composite-actions/enforce-jira-issue-key
with:
jira_base_url: ${{ secrets.TIP_JIRA_URL }}
jira_user_email: ${{ secrets.TIP_JIRA_USER_EMAIL }}
jira_api_token: ${{ secrets.TIP_JIRA_API_TOKEN }}