Skip to content
This repository has been archived by the owner on Oct 26, 2023. It is now read-only.

DOM-50747: Update mpi-init and mpi-sync to debian 12. #848

DOM-50747: Update mpi-init and mpi-sync to debian 12.

DOM-50747: Update mpi-init and mpi-sync to debian 12. #848

Workflow file for this run

name: Go
on:
push:
branches: [ main ]
tags: [ 'v[0-9]+.[0-9]+.[0-9]+*' ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.docker_prep.outputs.version }}
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.21.3
- name: Cache build tools
uses: actions/cache@v3
with:
path: |
bin
testbin
key: ${{ runner.os }}-go120-${{ hashFiles('Makefile') }}
- name: Build
run: make build
- name: Test
run: make test
- name: Lint
run: make lint
- name: Upload coverage report
uses: codecov/codecov-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Github Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Quay
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: Prepare Docker image
id: docker_prep
run: |
DESCRIPTION="$(echo "${{ github.event.repository.description }}" | sed -r 's/:.+:[[:blank:]]*//')"
DOCKER_IMAGE=ghcr.io/${{ github.repository }}
DOCKER_IMAGE_MPI_INIT=ghcr.io/${{ github.repository }}-mpi-init
DOCKER_IMAGE_MPI_SYNC=ghcr.io/${{ github.repository }}-mpi-sync
VENDOR_IMAGE=quay.io/domino/distributed-compute-operator
VENDOR_IMAGE_MPI_INIT=quay.io/domino/distributed-compute-operator-mpi-init
VENDOR_IMAGE_MPI_SYNC=quay.io/domino/distributed-compute-operator-mpi-sync
VERSION=edge
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/}
elif [[ $GITHUB_REF == refs/heads/* ]]; then
VERSION=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's#/+#-#g')
elif [[ $GITHUB_REF == refs/pull/* ]]; then
VERSION=pr-${{ github.event.number }}
fi
TAGS="${DOCKER_IMAGE}:${VERSION},${VENDOR_IMAGE}:${VERSION}"
if [[ "${{ github.event_name }}" == "push" ]]; then
TAGS="$TAGS,${DOCKER_IMAGE}:sha-${GITHUB_SHA::8},${VENDOR_IMAGE}:sha-${GITHUB_SHA::8}"
fi
TAGS_MPI_INIT="${VENDOR_IMAGE_MPI_INIT}:${VERSION}"
TAGS_MPI_SYNC="${VENDOR_IMAGE_MPI_SYNC}:${VERSION}"
echo "description=${DESCRIPTION}" >> $GITHUB_OUTPUT
echo "image=${DOCKER_IMAGE}" >> $GITHUB_OUTPUT
echo "image_mpi_init=${DOCKER_IMAGE_MPI_INIT}" >> $GITHUB_OUTPUT
echo "image_mpi_sync=${DOCKER_IMAGE_MPI_SYNC}" >> $GITHUB_OUTPUT
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "tags=${TAGS}" >> $GITHUB_OUTPUT
echo "tags_mpi_init=${TAGS_MPI_INIT}" >> $GITHUB_OUTPUT
echo "tags_mpi_sync=${TAGS_MPI_SYNC}" >> $GITHUB_OUTPUT
echo "created=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
- name: Build and push Docker image
id: docker_build
uses: docker/build-push-action@v4
with:
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.docker_prep.outputs.tags }}
cache-to: type=registry,ref=${{ steps.docker_prep.outputs.image }}:buildcache,mode=max
cache-from: type=registry,ref=${{ steps.docker_prep.outputs.image }}:buildcache
labels: |
org.opencontainers.image.title=${{ github.event.repository.name }}
org.opencontainers.image.description=${{ steps.docker_prep.outputs.description }}
org.opencontainers.image.url=${{ github.event.repository.html_url }}
org.opencontainers.image.source=${{ github.event.repository.clone_url }}
org.opencontainers.image.version=${{ steps.docker_prep.outputs.version }}
org.opencontainers.image.created=${{ steps.docker_prep.outputs.created }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.licenses=${{ github.event.repository.license.spdx_id }}
- name: Build and push Docker image for MPI init container
id: docker_build_mpi_init
uses: docker/build-push-action@v4
with:
context: "{{defaultContext}}:dockerfiles"
platforms: linux/amd64,linux/arm64
file: mpi-init.Dockerfile
push: true
tags: ${{ steps.docker_prep.outputs.tags_mpi_init }}
cache-to: type=registry,ref=${{ steps.docker_prep.outputs.image_mpi_init }}:buildcache,mode=max
cache-from: type=registry,ref=${{ steps.docker_prep.outputs.image_mpi_init }}:buildcache
labels: |
org.opencontainers.image.title=${{ github.event.repository.name }}-mpi-init
org.opencontainers.image.description="Supplemental init container for DCO MPI worker"
org.opencontainers.image.url=${{ github.event.repository.html_url }}
org.opencontainers.image.version=${{ steps.docker_prep.outputs.version }}
org.opencontainers.image.created=${{ steps.docker_prep.outputs.created }}
org.opencontainers.image.revision=${{ github.sha }}
- name: Build and push Docker image for MPI file sync container
id: docker_build_mpi_sync
uses: docker/build-push-action@v4
with:
context: "{{defaultContext}}:dockerfiles"
platforms: linux/amd64,linux/arm64
file: mpi-sync.Dockerfile
push: true
tags: ${{ steps.docker_prep.outputs.tags_mpi_sync }}
cache-to: type=registry,ref=${{ steps.docker_prep.outputs.image_mpi_sync }}:buildcache,mode=max
cache-from: type=registry,ref=${{ steps.docker_prep.outputs.image_mpi_sync }}:buildcache
labels: |
org.opencontainers.image.title=${{ github.event.repository.name }}-mpi-sync
org.opencontainers.image.description="Supplemental file sync container for DCO MPI worker"
org.opencontainers.image.url=${{ github.event.repository.html_url }}
org.opencontainers.image.version=${{ steps.docker_prep.outputs.version }}
org.opencontainers.image.created=${{ steps.docker_prep.outputs.created }}
org.opencontainers.image.revision=${{ github.sha }}
helm:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v3
- name: Install Helm
run: |
make helm
echo "HELM_BIN=./bin/helm" >> $GITHUB_ENV
- name: Package and push chart to ghcr.io
run: |
REGISTRY=ghcr.io
./scripts/release/helm.sh login -h "$REGISTRY" -u "${{ github.repository_owner }}" -p "${{ secrets.BOT_CR_PAT }}"
./scripts/release/helm.sh push -r "$REGISTRY/${{ github.repository_owner }}/helm" -v "${{ needs.build.outputs.version }}"
- name: Package and push chart to gcr.io
run: |
REGISTRY=gcr.io
PASSWORD="$(echo ${{ secrets.GCR_PASSWORD }} | base64 --decode)"
./scripts/release/helm.sh login -h "$REGISTRY" -n "${{ secrets.GCR_NAMESPACE }}" -u "${{ secrets.GCR_USERNAME }}" -p "$PASSWORD"
./scripts/release/helm.sh push -r "$REGISTRY/${{ secrets.GCR_NAMESPACE }}" -v "${{ needs.build.outputs.version }}"
release:
runs-on: ubuntu-latest
needs: build
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.21.3
- name: Publish Github release
uses: goreleaser/goreleaser-action@v4
with:
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}