mirror of
https://github.com/Telecominfraproject/wlan-cloud-ucentralgw.git
synced 2026-01-27 10:23:13 +00:00
Adapt new config file changes Fix script name Add working-directory Run docker-compose exec in the background Test Github actions working-directory behaviour Revert previous test Change shebang path Add some debug information to workflow Disable pseudo-tty allocation Fix variable name
113 lines
2.9 KiB
YAML
113 lines
2.9 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
paths-ignore:
|
|
- 'openapi/**'
|
|
- '**.md'
|
|
branches:
|
|
- master
|
|
- dev-microservice
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
- dev-microservice
|
|
|
|
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:
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: build Docker image
|
|
run: docker build -t wlan-cloud-ucentralgw:${{ github.sha }} .
|
|
|
|
- name: log into Docker registry
|
|
uses: docker/login-action@v1
|
|
with:
|
|
registry: ${{ env.DOCKER_REGISTRY_URL }}
|
|
username: ${{ env.DOCKER_REGISTRY_USERNAME }}
|
|
password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
|
|
|
|
- name: push Docker image
|
|
run: |
|
|
TAGS="${{ github.sha }}"
|
|
|
|
if [ ${GITHUB_REF} == "refs/heads/master" ]
|
|
then
|
|
TAGS="$TAGS ${GITHUB_REF#refs/heads/}"
|
|
else # PR build
|
|
CURRENT_TAG=$(echo ${GITHUB_HEAD_REF#refs/heads/} | tr '/' '-')
|
|
TAGS="$TAGS $CURRENT_TAG"
|
|
fi
|
|
|
|
echo "Pushing tags $TAGS"
|
|
|
|
for tag in $TAGS; do
|
|
docker tag wlan-cloud-ucentralgw:${{ github.sha }} ${{ env.DOCKER_REGISTRY_URL }}/ucentralgw:$tag
|
|
docker push ${{ env.DOCKER_REGISTRY_URL }}/ucentralgw:$tag
|
|
done
|
|
|
|
docker-compose:
|
|
runs-on: ubuntu-20.04
|
|
needs: docker
|
|
steps:
|
|
- name: Check out repository
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Instantiate Docker Compose deployment
|
|
working-directory: ./docker-compose
|
|
env:
|
|
UCENTRALGW_TAG: ${{ github.sha }}
|
|
run: |
|
|
docker-compose up -d
|
|
|
|
- name: Wait for uCentralSec to be alive and kicking
|
|
run: |
|
|
n=0
|
|
until [ "$n" -ge 3 ]
|
|
do
|
|
curl -s 127.0.0.1:16102 && break
|
|
n=$((n+1))
|
|
if [ "$n" -eq 3]; then
|
|
exit 1
|
|
else
|
|
sleep 3
|
|
fi
|
|
done
|
|
|
|
- name: Add self-signed certificates to system trust store of containers
|
|
working-directory: ./docker-compose
|
|
run: |
|
|
./add-ca-cert.sh
|
|
|
|
- name: Check functionality of microservices
|
|
env:
|
|
UCENTRALSEC: "ucentral.wlan.local:16001"
|
|
FLAGS: "-s --cacert docker-compose/certs/restapi-ca.pem --resolve ucentral.wlan.local:16001:127.0.0.1"
|
|
run: |
|
|
./test_scripts/curl/cli listdevices
|
|
|
|
- name: Display information about running containers and log ucentralgw output
|
|
working-directory: ./docker-compose
|
|
if: always()
|
|
run: |
|
|
docker-compose ps -a
|
|
docker-compose logs
|
|
|
|
# disable until repo is public
|
|
#- name: export Docker image
|
|
# run: docker image save -o wlan-cloud-ucentralgw-${{ github.sha }}.tar wlan-cloud-ucentralgw:${{ github.sha }}
|
|
|
|
#- uses: actions/upload-artifact@v2
|
|
# with:
|
|
# name: docker-image
|
|
# path: wlan-cloud-ucentralgw-${{ github.sha }}.tar
|