Rewrote license activation to use a lock to prevent race-conditions.
This commit is contained in:
@@ -57,18 +57,19 @@ runs:
|
||||
version: ${{ inputs.version }}
|
||||
platform: ${{ inputs.platform }}
|
||||
- name: "Pull Unity container."
|
||||
id: lock
|
||||
run: |
|
||||
LOCK_NAME="unity-lock:unity-lock"
|
||||
echo "lockName=$LOCK_NAME" >> "$GITHUB_OUTPUT"
|
||||
|
||||
# Acquire Docker lock for exclusive access to retag the static image
|
||||
bash ${{ github.action_path }}/acquire_lock.sh "$LOCK_NAME"
|
||||
|
||||
IMAGE_TAG="${{ inputs.imageTag }}"
|
||||
CONTAINER="${{ steps.getContainer.outputs.container }}"
|
||||
|
||||
CACHED_CONTAINER="$CONTAINER-activated"
|
||||
# Activate the license on build.
|
||||
# DOCKER_BUILDKIT=1 \
|
||||
# SERIAL="${{ inputs.serial }}" USERNAME="${{ inputs.email }}" PASSWORD="${{ inputs.password }}" \
|
||||
# docker build --secret id=SERIAL,env=SERIAL --secret id=USERNAME,env=USERNAME --secret id=PASSWORD,env=PASSWORD \
|
||||
# -t $CACHED_CONTAINER --build-arg IMAGE=$CONTAINER ${{ github.action_path }}
|
||||
docker build -t $CACHED_CONTAINER --build-arg IMAGE=$CONTAINER ${{ github.action_path }}
|
||||
|
||||
docker tag $CACHED_CONTAINER ${{ inputs.imageTag }}
|
||||
CACHED_CONTAINER="$CONTAINER-cached"
|
||||
docker build -t "$CACHED_CONTAINER" --build-arg IMAGE="$CONTAINER" ${{ github.action_path }}
|
||||
docker tag "$CACHED_CONTAINER" "$IMAGE_TAG"
|
||||
shell: bash
|
||||
- name: "Get Unity Command."
|
||||
id: command
|
||||
@@ -87,6 +88,7 @@ runs:
|
||||
SSH_PUBLIC_KEY: ${{ inputs.sshPublicKey }}
|
||||
SSH_PRIVATE_KEY: ${{ inputs.sshPrivateKey }}
|
||||
CATCH_ERRORS: ${{ inputs.catchErrors }}
|
||||
LOCK_NAME: ${{ steps.lock.outputs.lockName }}
|
||||
with:
|
||||
serial: ${{ inputs.serial }}
|
||||
# serial: "activated"
|
||||
@@ -94,4 +96,11 @@ runs:
|
||||
password: ${{ inputs.password }}
|
||||
command: ${{ steps.command.outputs.command }}
|
||||
unityBuilder: ${{ inputs.unityBuilder }}
|
||||
- name: "Release Unity Docker lock."
|
||||
if: ${{ always() }}
|
||||
run: |
|
||||
LOCK_NAME="${{ steps.lock.outputs.lockName }}"
|
||||
echo "Releasing Docker lock '$LOCK_NAME'..."
|
||||
docker rmi "$LOCK_NAME" >/dev/null 2>&1 || true
|
||||
shell: bash
|
||||
|
||||
|
||||
Reference in New Issue
Block a user