Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trigger deploy on upstream version change #71

Draft
wants to merge 35 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
70a04ca
update workflow displatch
mikenye Mar 18, 2022
5d02905
work on upstream version checks
mikenye Mar 18, 2022
3b99fc3
upstream versions
mikenye Mar 18, 2022
8c1bba5
show current versions
mikenye Mar 18, 2022
902e266
display versions
mikenye Mar 18, 2022
4e623bc
troubleshoot
mikenye Mar 18, 2022
3d3586d
linting
mikenye Mar 18, 2022
ee0be67
troubleshoot
mikenye Mar 18, 2022
3bfc423
troubleshoot
mikenye Mar 18, 2022
d4fdead
parallelize
mikenye Mar 18, 2022
fa47e71
more parallel
mikenye Mar 18, 2022
3acb7de
naming
mikenye Mar 18, 2022
f18ed10
store rtl-sdr commit hash
mikenye Mar 18, 2022
d553afd
add get_current_version_wreadsb
mikenye Mar 19, 2022
7c72394
linting
mikenye Mar 19, 2022
a60ac9f
add get_latest_version_wreadsb
mikenye Mar 19, 2022
9e6d5f8
linting
mikenye Mar 19, 2022
9b3d23e
fix wreadsb build
mikenye Mar 19, 2022
354e09c
fix wreadsb
mikenye Mar 19, 2022
3402669
show wreadsb versions
mikenye Mar 19, 2022
8b28fd3
add wreads to display
mikenye Mar 19, 2022
5d2096d
add get_current_version_soapyrtlsdr
mikenye Mar 19, 2022
77036dc
add get_current_version_soapyrtlsdr
mikenye Mar 19, 2022
5e68849
add soapyrtlsdr
mikenye Mar 19, 2022
ffc0f9b
fix typos
mikenye Mar 19, 2022
006cfec
linting
mikenye Mar 19, 2022
02b6bb7
add get_current_version_rtlsdr
mikenye Mar 19, 2022
c64c71e
add get_latest_version_rtlsdr
mikenye Mar 19, 2022
571de28
add get_current_version_acarsdec
mikenye Mar 19, 2022
61f8947
add get_latest_version_acarsdec
mikenye Mar 19, 2022
f728135
store commit hash of libacars
mikenye Mar 19, 2022
500e8db
linting
mikenye Mar 19, 2022
e5e80db
fix label
mikenye Mar 19, 2022
fc0a814
fix error
mikenye Mar 19, 2022
f227a65
Merge branch 'main' into trigger_deploy_on_upstream_version_change
mikenye Mar 19, 2022
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
292 changes: 292 additions & 0 deletions .github/workflows/check_upstream_versions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,292 @@
---
name: Check Upstream Versions

on:
pull_request:

jobs:

get_current_version_dump978:
name: Get current dump978-fa version from ghcr.io/${{ github.repository }}:dump978-full
runs-on: ubuntu-latest
outputs:
current-version: ${{ steps.current-version.outputs.currver }}
steps:

- name: Get current version
id: current-version
run: |
set -x
docker pull ghcr.io/${{ github.repository }}:dump978-full
OUTPUT_VERSION=$(docker run --rm --entrypoint dump978-fa ghcr.io/${{ github.repository }}:dump978-full --version 2>&1 | cut -d " " -f 2)
echo "::set-output name=currver::$OUTPUT_VERSION"

get_current_version_readsb:
name: Get current readsb version from ghcr.io/${{ github.repository }}:readsb-netonly
runs-on: ubuntu-latest
outputs:
current-version: ${{ steps.current-version.outputs.currver }}
steps:

- name: Get current version
id: current-version
run: |
set -x
docker pull ghcr.io/${{ github.repository }}:readsb-netonly
OUTPUT_VERSION=$(docker run --rm --entrypoint readsb ghcr.io/${{ github.repository }}:readsb-netonly --version 2>&1 | cut -d " " -f 2)
echo "::set-output name=currver::$OUTPUT_VERSION"

get_current_version_soapyrtlsdr:
name: Get current SoapySDR version from ghcr.io/${{ github.repository }}:soapyrtlsdr
runs-on: ubuntu-latest
outputs:
current-version-soapysdr: ${{ steps.current-version.outputs.currversoapysdr }}
current-version-soapyrtlsdr: ${{ steps.current-version.outputs.currversoapyrtlsdr }}
steps:

- name: Get current version
id: current-version
run: |
set -x
docker pull ghcr.io/${{ github.repository }}:soapyrtlsdr
SOAPYSDRVER=$(docker run --rm --entrypoint SoapySDRUtil ghcr.io/${{ github.repository }}:soapyrtlsdr --info | grep Lib\ Version:)
SOAPYRTLSDRVER=$(docker run --rm --entrypoint SoapySDRUtil ghcr.io/${{ github.repository }}:soapyrtlsdr --info | grep librtlsdrSupport.so)
echo "::set-output name=currversoapysdr::$SOAPYSDRVER"
echo "::set-output name=currversoapyrtlsdr::$SOAPYRTLSDRVER"

get_current_version_wreadsb:
name: Get current wreadsb version from ghcr.io/${{ github.repository }}:wreadsb
runs-on: ubuntu-latest
outputs:
current-version: ${{ steps.current-version.outputs.currver }}
steps:

- name: Get current version
id: current-version
run: |
set -x
docker pull ghcr.io/${{ github.repository }}:wreadsb
OUTPUT_VERSION=$(docker run --rm --entrypoint readsb ghcr.io/${{ github.repository }}:wreadsb --version 2>&1)
echo "::set-output name=currver::$OUTPUT_VERSION"

get_current_version_rtlsdr:
name: Get current rtl-sdr version from ghcr.io/${{ github.repository }}:rtlsdr
runs-on: ubuntu-latest
outputs:
current-version: ${{ steps.current-version.outputs.currver }}
steps:

- name: Get current version
id: current-version
run: |
set -x
docker pull ghcr.io/${{ github.repository }}:rtlsdr
OUTPUT_VERSION=$(docker run --rm --entrypoint cat ghcr.io/${{ github.repository }}:rtlsdr /CONTAINER_VERSION)
echo "::set-output name=currver::$OUTPUT_VERSION"

get_current_version_acarsdec:
name: Get current libacars version from ghcr.io/${{ github.repository }}:acars-decoder
runs-on: ubuntu-latest
outputs:
current-version: ${{ steps.current-version.outputs.currver }}
steps:

- name: Get current version
id: current-version
run: |
set -x
docker pull ghcr.io/${{ github.repository }}:acars-decoder
OUTPUT_VERSION=$(docker run --rm --entrypoint cat ghcr.io/${{ github.repository }}:acars-decoder /CONTAINER_VERSION)
echo "::set-output name=currver::$OUTPUT_VERSION"

get_latest_version_dump978:
name: Get latest dump978-fa version
runs-on: ubuntu-latest
outputs:
latest-version: ${{ steps.latest-version.outputs.latestver }}
steps:

- name: Build
uses: docker/build-push-action@v2
with:
push: false
load: true
tags: dump978:latest
file: Dockerfile.dump978-full
- name: Get latest version
id: latest-version
run: |
set -x
OUTPUT_VERSION=$(docker run --rm --entrypoint dump978-fa dump978:latest --version 2>&1 | cut -d " " -f 2)
echo "::set-output name=latestver::$OUTPUT_VERSION"

get_latest_version_readsb:
name: Get latest readsb version
runs-on: ubuntu-latest
outputs:
latest-version: ${{ steps.latest-version.outputs.latestver }}
steps:

- name: Build
uses: docker/build-push-action@v2
with:
push: false
load: true
tags: readsb:latest
file: Dockerfile.readsb-netonly
- name: Get latest version
id: latest-version
run: |
set -x
OUTPUT_VERSION=$(docker run --rm --entrypoint readsb readsb:latest --version 2>&1 | cut -d " " -f 2)
echo "::set-output name=latestver::$OUTPUT_VERSION"

get_latest_version_wreadsb:
name: Get latest wreadsb version
runs-on: ubuntu-latest
outputs:
latest-version: ${{ steps.latest-version.outputs.latestver }}
steps:

- name: Build
uses: docker/build-push-action@v2
with:
push: false
load: true
tags: wreadsb:latest
file: Dockerfile.wreadsb
- name: Get latest version
id: latest-version
run: |
set -x
OUTPUT_VERSION=$(docker run --rm --entrypoint readsb wreadsb:latest --version 2>&1)
echo "::set-output name=latestver::$OUTPUT_VERSION"

get_latest_version_soapyrtlsdr:
name: Get latest SoapySDR version
runs-on: ubuntu-latest
outputs:
latest-version-soapysdr: ${{ steps.latest-version.outputs.latestversoapysdr }}
latest-version-soapyrtlsdr: ${{ steps.latest-version.outputs.latestversoapyrtlsdr }}
steps:

- name: Build
uses: docker/build-push-action@v2
with:
push: false
load: true
tags: soapyrtlsdr:latest
file: Dockerfile.soapyrtlsdr
- name: Get latest version
id: latest-version
run: |
set -x
SOAPYSDRVER=$(docker run --rm --entrypoint SoapySDRUtil soapyrtlsdr:latest --info | grep Lib\ Version:)
SOAPYRTLSDRVER=$(docker run --rm --entrypoint SoapySDRUtil soapyrtlsdr:latest --info | grep librtlsdrSupport.so)
echo "::set-output name=latestversoapysdr::$SOAPYSDRVER"
echo "::set-output name=latestversoapyrtlsdr::$SOAPYRTLSDRVER"

get_latest_version_rtlsdr:
name: Get latest rtlsdr version
runs-on: ubuntu-latest
outputs:
latest-version: ${{ steps.latest-version.outputs.latestver }}
steps:

- name: Build
uses: docker/build-push-action@v2
with:
push: false
load: true
tags: rtlsdr:latest
file: Dockerfile.rtlsdr
- name: Get latest version
id: latest-version
run: |
set -x
OUTPUT_VERSION=$(docker run --rm --entrypoint cat rtlsdr:latest /CONTAINER_VERSION)
echo "::set-output name=latestver::$OUTPUT_VERSION"

get_latest_version_acarsdec:
name: Get latest libacars version
runs-on: ubuntu-latest
outputs:
latest-version: ${{ steps.latest-version.outputs.latestver }}
steps:

- name: Build
uses: docker/build-push-action@v2
with:
push: false
load: true
tags: acars-decoder:latest
file: Dockerfile.acars-decoder
- name: Get latest version
id: latest-version
run: |
set -x
OUTPUT_VERSION=$(docker run --rm --entrypoint cat acars-decoder:latest /CONTAINER_VERSION)
echo "::set-output name=latestver::$OUTPUT_VERSION"

display_versions:
name: Display versions
needs:
- get_current_version_dump978
- get_latest_version_dump978
- get_current_version_readsb
- get_latest_version_readsb
- get_current_version_wreadsb
- get_latest_version_wreadsb
- get_current_version_soapyrtlsdr
- get_latest_version_soapyrtlsdr
- get_current_version_rtlsdr
- get_latest_version_rtlsdr
- get_current_version_acarsdec
- get_latest_version_acarsdec
runs-on: ubuntu-latest
steps:
- name: Display versions
run: |
echo "dump978:"
echo " * current: ${{ needs.get_current_version_dump978.outputs.current-version }}"
echo " * latest: ${{ needs.get_latest_version_dump978.outputs.latest-version }}"
echo ""
echo "readsb:"
echo " * current: ${{ needs.get_current_version_readsb.outputs.current-version }}"
echo " * latest: ${{ needs.get_latest_version_readsb.outputs.latest-version }}"
echo ""
echo "wreadsb:"
echo " * current: ${{ needs.get_current_version_wreadsb.outputs.current-version }}"
echo " * latest: ${{ needs.get_latest_version_wreadsb.outputs.latest-version }}"
echo ""
echo "RTL-SDR"
echo " * current: ${{ needs.get_current_version_rtlsdr.outputs.current-version }}"
echo " * latest: ${{ needs.get_latest_version_rtlsdr.outputs.latest-version }}"
echo ""
echo "SoapySDR:"
echo " * current: ${{ needs.get_current_version_soapyrtlsdr.outputs.current-version-soapysdr }}"
echo " * latest: ${{ needs.get_latest_version_soapyrtlsdr.outputs.latest-version-soapysdr }}"
echo ""
echo "SoapyRTLSDR:"
echo " * current: ${{ needs.get_current_version_soapyrtlsdr.outputs.current-version-soapyrtlsdr }}"
echo " * latest: ${{ needs.get_latest_version_soapyrtlsdr.outputs.latest-version-soapyrtlsdr }}"
echo ""
echo "libacars:"
echo " * current: ${{ needs.get_current_version_acarsdec.outputs.current-version }}"
echo " * latest: ${{ needs.get_latest_version_acarsdec.outputs.latest-version }}"

# trigger_deploy:
# name: Trigger deployment on new versions
# needs: [version_in_container, latest_version]
# if: ${{ needs.version_in_container.outputs.currver != needs.latest_version.outputs.latestver }}
# runs-on: ubuntu-latest
# env:
# WORKFLOW_AUTH_TOKEN: ${{ secrets.GH_PAT_MIKENYE }}
# WORKFLOW_REPO: ${{ github.repository }}
# WORKFLOW_FILE: deploy.yml
# WORKFLOW_REASON: "triggered via check_versions.yml in ${{ github.repository }}"
# steps:
# - name: Trigger ${{ env.WORKFLOW_FILE }} in ${{ env.WORKFLOW_REPO }}
# run: |
# echo "$WORKFLOW_AUTH_TOKEN" | gh auth login --with-token
# gh workflow run --ref main --repo "$WORKFLOW_REPO" "$WORKFLOW_FILE" -f reason="$WORKFLOW_REASON"
20 changes: 20 additions & 0 deletions .github/workflows/deploy_ghcr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ name: Deploy
on:
# Enable manual running of action if necessary
workflow_dispatch:
inputs:
reason:
required: true
description: 'Reason for running this workflow'
# Build and deploy the image on pushes to main branch
push:
# Only publish on push to main branch
Expand All @@ -28,6 +32,22 @@ env:
IMAGE_NAME: ${{ github.repository }}

jobs:

workflow-dispatch:
name: Triggered via Workflow Dispatch?
# only run this step if workflow dispatch triggered
# log the reason the workflow dispatch was triggered
if: |
github.event_name == 'workflow_dispatch' &&
github.event.inputs.reason != ''
runs-on: ubuntu-latest
steps:
- name: Log dispatch reason
env:
INPUTS_REASON: ${{ github.event.inputs.reason }}
run: |
echo "Workflow dispatch reason: $INPUTS_REASON"

hadolint:
name: Run hadolint against docker files
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions Dockerfile.acars-decoder
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ RUN set -x && \
git rev-parse HEAD > /CONTAINER_VERSION && \
mkdir build && \
pushd build && \
git rev-parse HEAD > /CONTAINER_VERSION && \
cmake ../ && \
make && \
make install && \
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile.rtlsdr
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ RUN set -x && \
'git://git.osmocom.org/rtl-sdr' \
/src/rtl-sdr \
&& \
# prepare to build
# store current commit hash
mkdir -p /src/rtl-sdr/build && \
pushd /src/rtl-sdr/build && \
git rev-parse HEAD > /CONTAINER_VERSION && \
# prepare to build
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DDETACH_KERNEL_DRIVER=ON \
Expand Down