setup java and dont auto remove container so logs can be obtained #9
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
name: UDMI Integration Suite | |
on: | |
push: | |
branches: | |
- '**' | |
workflow_dispatch: | |
jobs: | |
images: | |
name: Build Docker Images | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
timeout-minutes: 5 | |
strategy: | |
fail-fast: false | |
matrix: | |
container: [ "udmis", "validator", "pubber" ] | |
env: | |
PUSH_REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
CONTAINER: ${{ matrix.container }} | |
REF_NAME: ${{ github.ref_name }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
fetch-tags: true | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- name: Log in to the github registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.PUSH_REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Container build and push | |
run: | | |
revhash=$(git log -n 1 --pretty=format:"%h") | |
IMAGE_HASH=g${revhash:0:8} | |
PUSH_REPO=$PUSH_REGISTRY/${IMAGE_NAME,,} | |
TAG_BASE=$PUSH_REPO:$CONTAINER | |
PUSH_TAG=${TAG_BASE}-$IMAGE_HASH | |
echo PUSH_TAG=$PUSH_TAG >> $GITHUB_ENV | |
bin/clone_model | |
$CONTAINER/bin/build check | |
bin/container $CONTAINER push --no-check $PUSH_TAG | |
docker tag $CONTAINER:latest $TAG_BASE-latest | |
docker push $TAG_BASE-latest | |
docker tag $CONTAINER:latest $TAG_BASE-$REF_NAME | |
docker push $TAG_BASE-$REF_NAME | |
echo Pushed built $CONTAINER container as $PUSH_TAG | tee -a $GITHUB_STEP_SUMMARY | |
- name: Docker images summary | |
run: | | |
docker images | |
echo | |
docker history $PUSH_TAG | |
mapper: | |
name: Simple mapper test | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
needs: images | |
strategy: | |
fail-fast: false | |
env: | |
IMAGE_NAME: ${{ github.repository }} | |
REF_NAME: ${{ github.ref_name }} | |
steps: | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- name: Checkout source | |
uses: actions/checkout@v4 | |
- name: Setup Environment | |
run: | | |
sudo apt-get install moreutils | |
git clone https://github.com/faucetsdn/udmi_site_model.git | |
ln -s udmi_site_model/ site_model | |
(cd site_model; git log -n 1) | |
jq ".device_id = \"$DEVICE_ID\"" site_model/cloud_iot_config.json | sponge site_model/cloud_iot_config.json | |
jq . site_model/cloud_iot_config.json | |
docker network create udminet --subnet 192.168.99.0/24 | |
- name: Start UDMIS container | |
run: | | |
cat udmi_site_model/cloud_iot_config.json | |
docker run -d --net udminet --name udmis -p 8883:8883 \ | |
-v $(realpath udmi_site_model):/root/site_model \ | |
-v $PWD/var/tmp:/tmp \ | |
-v $PWD/var/etcd:/root/udmi/var/etcd \ | |
-v $PWD/var/mosquitto:/etc/mosquitto \ | |
ghcr.io/faucetsdn/udmi:udmis-latest udmi/bin/start_local block site_model/cloud_iot_config.json | |
for count in `seq 0 30`; do | |
echo Waiting for UDMIS startup $((30 - count)) | |
[[ ! -f var/tmp/pod_ready.txt ]] || break | |
(docker ps | fgrep -q udmis) || break | |
sleep 1 | |
done | |
ls -l var/tmp/pod_ready.txt 2>&1 | |
- name: start and test local servers | |
run: | | |
bin/setup_base | |
- name: run test suite | |
run: | | |
misc/discoverynode/testing/e2e/test_local.sh udmi_site_model |