Skip to content

Delivery pipeline triggered by Ishaan-Datta #56

Delivery pipeline triggered by Ishaan-Datta

Delivery pipeline triggered by Ishaan-Datta #56

Workflow file for this run

# Compiling code into container and uploading to repository
name: Delivery Pipeline
run-name: Delivery pipeline triggered by ${{ github.actor }}
on:
push: # pushes to the main branch only occur if the merge request has been accepted
branches:
- main
workflow_call:
outputs:
version:
description: "The latest docker image version"
value: ${{ jobs.build.outputs.container_version }}
inputs:
deployment:
required: true
default: true
type: boolean
workflow_dispatch:
inputs:
deployment:
description: 'Run unit and benchmarking tests?'
required: true
default: false
type: boolean
jobs:
build:
runs-on: self-hosted
outputs:
container_version: ${{ steps.get_next_version.outputs.version }}
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Retrieve Docker Hub tags and determine the next version
id: get_next_version
run: |
BRANCH_NAME="${{ github.ref_name }}"
IMAGE_PREFIX="jetson_ros:${BRANCH_NAME}-v"
TAGS=$(wget -q -O - "https://hub.docker.com/v2/namespaces/agrobotappliedai/repositories/jetsoncontainers-dev/tags?page_size=100" | grep -o '"name": *"[^"]*' | grep -o '[^"]*$')
VERSION_TAGS=$(echo "$TAGS" | grep -E "^${IMAGE_PREFIX}[0-9]+$" || true)
if [ -z "$VERSION_TAGS" ]; then
echo "No matching tags found, setting version to 1"
echo "version=1" >> $GITHUB_OUTPUT
else
MAX_VERSION=$(echo "$VERSION_TAGS" | sed -e "s/^${IMAGE_PREFIX}//" | sort -n | tail -1)
NEXT_VERSION=$((MAX_VERSION + 1))
echo "Found existing versions. Incrementing to version $NEXT_VERSION"
echo "version=$NEXT_VERSION" >> $GITHUB_OUTPUT
fi
- run: echo "The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- run: echo ${{ steps.get_next_version.outputs.version }}
- name: Show directory contents
run: |
echo "Current directory: $(pwd)"
echo "Directory contents:"
tree
- name: List files in the repository
run: |
echo "github workspace folder"
ls ${{ github.workspace }}
- name: Build and push multi-platform Docker image
uses: docker/build-push-action@v6
with:
push: true
context: "{{defaultContext}}:Containers"
platforms: linux/arm64
file: ./Jetson.Dockerfile
network: host
build-args: BRANCH_NAME="${{ github.ref_name }}"
tags: |
"agrobotappliedai/jetson_ros:${{ github.ref_name }}-latest"
"agrobotappliedai/jetson_ros:${{ github.ref_name }}-v${{ steps.get_next_version.outputs.version }}"