1
0
mirror of synced 2026-01-17 09:03:14 +00:00
Frank Halasz 4b95a8b5d3
Windows installer and medley script for running Medley in Docker on Windows (#1077)
* Update docker file build to use new deb linux installers;  move Dockefile to .github/workflows since its really only useable from the buildDocker.yml workflow

* Fix typo in dockerfile location

* remove extraneous " in >>GITHUB_ENV statements

* Fix handling of TARGETPLATFORM in Dockerfile

* Trying with just one platform

* Fix issues with missing man-db in docker build workflow; added man-db to depends in deb builds for linux

* Sicthed docker from tightvnc to tigervnc to match oio.  This getting the apt package name right.

* Going back to single platform to debug this thing

* Trying with just arm64

* Removing arm/v7 from docker images.  Takes too long to build and just wastes our github actions minutes.  This is assuming its a never used feature since docker is not big on raspberry pis and their ilk.

* Fix typo in control-linux; update build_deb so that files in /usr/local installed by deb are owned by root; add ubuntu user and nano in docker file for dbebugging;  when in draft only create for x86_64 platform

* Fix typo in buildDocker.yml

* Add sudo to docker image; in docker image ensure that all /usr/local/interlisp files are owned by root

* Add securityTypes none to docker entrypoint

* Updated docker base to Ubuntu 22.10 to get fixed xrdp; add xrdp to the docker image; updated user permission in docker image;

* In Dockerfile make xrdp install noninteractive

* Update medley.sh scripts to handle docker case

* Fix a couple of typos

* BuildDcoker: added pulling latest draft release (if any) when this is a draft docker build; removed checkout of medley code cause its not used

* BuildDocker: added medley checkout backin - turns pout its needed by a bunch of actions even though I dont really think they use it

* BuildDocker: moved download assets to use gh instaed of a marketplace action becauase that action could not handle draft releases.

* Tweaking medley.sh and associated tweaks to work Windows via wsl medley and docker

* adding first pass at powershell script for windows docker and wsl

* Tuning how Xvnc, medley, and vncviewer handle the various ways of exiting - eg logout vs closing viewer window.

* Tuning vncviewer launch to make sure that tty works as expected when medley.sh runs in background

* Minor typo fixes and added extra check to use of /run/shm in medley_vnc.sh

* Added SSH_KEY secret to buildReleaseIncDocker workflow

* Gertting the add SSH_KEY secret into orkflows right this time, hopefully

* Adding TERM env variable and setting USER to medley in docker image

* Debugging medley.ps1 and adding a couple of arguments

* Typo in Dockerfile medley

* Synchronizing flag processing and usage for medley.ps1 and medley.sh; refactored medley_args.sh and medley_usage.sh code.

* Adding first pass at windows installer

* Adding first pass an inno setup script for Windows installation

* Update buildLoadup workflow and downloads page for windows installer

* Fix typo in buildLoadup

* BuildLoadup make sure windows runner uses powershell

* Another typo in buildLoadup

* Another typo in buildLoadup; damn those double quotes

* Updating handling of windows installer in buildLoadup, added vncviewer to medley.iss install

* Unknown syntax error in buildLoadup

* Another damn typo from double quotes

* buildLoadup: fixed loadup job outputs

* buidLoadup: fixed bug with COMBINED_RELEASE_TAG; fixed Upload script in windows job to be compatible with actions.script v6.

* buidLoadup: upload win installer adapted to find draft releases as well as full releases

* BuildLoadup: fixing up javascript in actions in windows job to use / instead of \ in pathname

* BuildLoadup: changing win installer update to same action used for other release assets

* Fix windows installer file name; in BuildLoadup move update downl;oad page to the Windows runner because uploading the window-installer changes the release download url, so updating the downloads page must be done after the windows installer upload.; General buildLoadup cleanup

* Run md2html to update downloads page

* Fix typo in build_deb.sh

* Removing some leftover crud in medley_usage.sh

* Fixing up windows installer a bit, mostly cosmetic

* Adding support for WSL1; mostly forcing --vnc and changing how to find open ports and displays since WSL1 networking is different tha WSL2

* Update manual page for new Windows Medley script

* First pass done for man page that incorporates new Windows medley script.  Add Xvnc wait before calling run-medley in case of docker to prevent occasonal missing X windows server error.

* Change buildLoadup to update man page to a draft if this is a draft run.
2023-02-18 06:19:57 -08:00

267 lines
8.8 KiB
YAML

#*******************************************************************************
# buidDocker.yml
#
# Workflow to build and push a multiplatform (amd64, arm64 & arm7) Linux Docker
# image for Medley. This workflow uses the latest Maiko docker image and the
# latest Medley release on github.
#
# This workflow contains a sentry that causes it to skip the build (as identified
# by its commit SHA) if its already been done. Setting the "force" input to true
# will bypass this sentry,
#
# Updated 2022-01-18 by Frank Halasz from on earlier buildDocker.yml
#
# Copyright 2022 by Interlisp.org
#
# ******************************************************************************
name: 'Build/Push Docker Image'
# Run this workflow on ...
on:
workflow_dispatch:
inputs:
draft:
description: "Mark this as a draft release"
type: choice
options:
- 'false'
- 'true'
force:
description: "Force build even if build already successfully completed for this commit"
type: choice
options:
- 'false'
- 'true'
workflow_call:
outputs:
successful:
description: "'True' if medley docker build completed successully"
value: ${{ jobs.complete.outputs.build_successful }}
inputs:
draft:
description: "Mark this as a draft release"
required: false
type: string
default: 'false'
force:
description: "Force build even if build already successfully completed for this commit"
required: false
type: string
default: 'false'
secrets:
DOCKER_USERNAME:
required: true
DOCKER_PASSWORD:
required: true
defaults:
run:
shell: bash
jobs:
######################################################################################
# Regularize the inputs so they can be referenced the same way whether they are
# the result of a workflow_dispatch or a workflow_call
inputs:
runs-on: ubuntu-latest
outputs:
draft: ${{ steps.one.outputs.draft }}
force: ${{ steps.one.outputs.force }}
steps:
- id: one
run: >
if [ '${{ toJSON(inputs) }}' = 'null' ];
then
echo "workflow_dispatch";
echo "draft=${{ github.event.inputs.draft }}" >> $GITHUB_OUTPUT;
echo "force=${{ github.event.inputs.force }}" >> $GITHUB_OUTPUT;
else
echo "workflow_call";
echo "draft=${{ inputs.draft }}" >> $GITHUB_OUTPUT;
echo "force=${{ inputs.force }}" >> $GITHUB_OUTPUT;
fi
######################################################################################
# Use sentry-action to determine if this release has already been built
# based on the latest commit to the repo
sentry:
needs: inputs
runs-on: ubuntu-latest
outputs:
release_not_built: ${{ steps.check.outputs.release_not_built }}
steps:
# Checkout the actions for this repo owner
- name: Checkout Actions
uses: actions/checkout@v3
with:
repository: ${{ github.repository_owner }}/.github
path: ./Actions_${{ github.sha }}
- run: mv ./Actions_${{ github.sha }}/actions ../actions && rm -rf ./Actions_${{ github.sha }}
# Check if build already run for this commit
- name: Build already completed?
id: check
continue-on-error: true
uses: ./../actions/check-sentry-action
with:
tag: "docker"
######################################################################################
#
# Build and push the medley docker image
#
build_and-push:
runs-on: ubuntu-latest
needs: [inputs, sentry]
if: |
needs.sentry.outputs.release_not_built == 'true'
|| needs.inputs.outputs.force == 'true'
steps:
# Checkout latest commit
- name: Checkout Medley
uses: actions/checkout@v3
# Find latest release (draft or normal)
# and download its assets
- name: Download linux debs from latest (draft) release
run: |
tag=""
if [ "${{ needs.inputs.outputs.draft }}" = "true" ];
then
tag=$(gh release list | grep Draft | head -n 1 | awk '{ print $3 }')
fi
if [ -z "${tag}" ];
then
tag=$(gh release list | grep Latest | head -n 1 | awk '{ print $3 }')
fi
mkdir -p release_debs
gh release download ${tag} -D release_debs -p '*-linux-*.deb'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Get Maiko and Medley release information from name of deb files
# just downloaded from the Medley latest release
- name: Get info about Miako and Medley releases
id: release_info
run: |
regex="^[^0-9]*\([^_]*\)_\([^-]*-[^-]*\)-\([^-]*\)-\([^.]*\).*\$"
ls -1 release_debs | head -n 1 > debname.tmp
medley_release="medley-$(sed -e "s/${regex}/\1/" debname.tmp)"
maiko_release="maiko-$(sed -e "s/${regex}/\2/" debname.tmp)"
rm -f debname.tmp
echo "MEDLEY_RELEASE=${medley_release}" >> ${GITHUB_ENV}
echo "MAIKO_RELEASE=${maiko_release}" >> ${GITHUB_ENV}
# Set repo env variables
- name: Set repo/docker env variables
id: repo_env
run: |
repo_name="${GITHUB_REPOSITORY#*/}"
docker_namespace="$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')"
docker_image="${docker_namespace}/${repo_name}"
if [ "${{ needs.inputs.outputs.draft }}" = "false" ];
then
docker_tags="${docker_image}:latest,${docker_image}:${MEDLEY_RELEASE#*-}_${MAIKO_RELEASE#*-}"
platforms="linux/amd64,linux/arm64"
else
docker_tags="${docker_image}:draft"
platforms="linux/amd64"
fi
echo "REPO_NAME=${repo_name}" >> ${GITHUB_ENV}
echo "DOCKER_NAMESPACE=${docker_namespace}" >> ${GITHUB_ENV}
echo "DOCKER_IMAGE=${docker_image}" >> ${GITHUB_ENV}
echo "DOCKER_TAGS=${docker_tags}" >> ${GITHUB_ENV}
echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> ${GITHUB_ENV}
echo "PLATFORMS=${platforms}" >> ${GITHUB_ENV}
#linux/amd64,linux/arm64,linux/arm/v7
# Setup the Docker Machine Emulation environment.
- name: Set up QEMU
uses: docker/setup-qemu-action@master
with:
platforms: linux/amd64,linux/arm64,linux/arm/v7
# Setup the Docker Buildx funtion
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@master
# Login into DockerHub - required to store the created image
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
# Do the Docker Build using the Dockerfile in the repository
# checked out and the release tars just downloaded.
# Push the result to Docker Hub
- name: Build Docker Image for Push to Docker Hub
uses: docker/build-push-action@v3
with:
builder: ${{ steps.buildx.outputs.name }}
build-args: |
BUILD_DATE=${{ env.BUILD_DATE }}
MEDLEY_RELEASE=${{ env.MEDLEY_RELEASE }}
MAIKO_RELEASE=${{ env.MAIKO_RELEASE }}
REPO_OWNER=${{ github.repository_owner }}
context: ./release_debs
file: ./.github/workflows/Dockerfile_medley
platforms: ${{ env.PLATFORMS }}
# Push the result to DockerHub
push: true
tags: ${{ env.DOCKER_TAGS }}
######################################################################################
# Use set-sentry-action to determine set the sentry that says this release has
# been successfully built
complete:
runs-on: ubuntu-latest
outputs:
build_successful: ${{ steps.output.outputs.build_successful }}
needs: [inputs, sentry, build_and-push]
steps:
# Checkout the actions for this repo owner
- name: Checkout Actions
uses: actions/checkout@v3
with:
repository: ${{ github.repository_owner }}/.github
path: ./Actions_${{ github.sha }}
- run: mv ./Actions_${{ github.sha }}/actions ../actions && rm -rf ./Actions_${{ github.sha }}
# Set sentry
- name: Set flag that build for this commit has been completed
id: set
uses: ./../actions/set-sentry-action
with:
tag: "docker"
- name: Output
id: output
run: |
echo "build_successful='true'" >> ${GITHUB_OUTPUT}
######################################################################################