Compare commits
24 Commits
cpp23
...
add-mgbuil
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b6d630f4c1 | ||
|
|
f63cf18703 | ||
|
|
798c73f5de | ||
|
|
5e24f9b0b4 | ||
|
|
81c63e70d8 | ||
|
|
90e0f620c4 | ||
|
|
84749b2f05 | ||
|
|
9b2cb3d4d8 | ||
|
|
e46e3832d8 | ||
|
|
647d62a886 | ||
|
|
6504f04898 | ||
|
|
bf9b95de70 | ||
|
|
9f01e71c26 | ||
|
|
300f4d6163 | ||
|
|
b7d143ccbe | ||
|
|
1bf265dccd | ||
|
|
88c95f2949 | ||
|
|
3791fe3585 | ||
|
|
84ab085183 | ||
|
|
68d4884706 | ||
|
|
533d627a73 | ||
|
|
bfe61f0abb | ||
|
|
adf2508f88 | ||
|
|
b612e8a723 |
190
.github/workflows/release_mgbuilder.yml
vendored
Normal file
190
.github/workflows/release_mgbuilder.yml
vendored
Normal file
@@ -0,0 +1,190 @@
|
||||
name: Publish memgraph-builder docker images
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
toolchain_version:
|
||||
type: choice
|
||||
description: "Toolchain version for the builder"
|
||||
options:
|
||||
- v4
|
||||
- v5
|
||||
target_os:
|
||||
type: choice
|
||||
description: "Target OS for the builder"
|
||||
default: 'debian-11'
|
||||
options:
|
||||
- all
|
||||
- all-amd64
|
||||
- all-arm
|
||||
- amzn-2
|
||||
- centos-7
|
||||
- centos-9
|
||||
- debian-10
|
||||
- debian-11
|
||||
- debian-11-arm
|
||||
- fedora-36
|
||||
- ubuntu-18_04
|
||||
- ubuntu-20_04
|
||||
- ubuntu-22_04
|
||||
- ubuntu-22_04-arm
|
||||
force_release:
|
||||
type: boolean
|
||||
description: "Overwrite existing image on dockerhub"
|
||||
required: false
|
||||
default: false
|
||||
|
||||
jobs:
|
||||
amd_build:
|
||||
if: ${{ !startsWith(github.event.inputs.target_os, 'all') && !endsWith(github.event.inputs.target_os, '-arm') }}
|
||||
name: "Build and publish specific amd64 image"
|
||||
runs-on: [self-hosted, DockerMgBuild, X64]
|
||||
env:
|
||||
DOCKER_ORG: "memgraph"
|
||||
DOCKER_REPO: "memgraph-builder"
|
||||
DOCKER_IMAGE_TAG: "${{ github.event.inputs.toolchain_version }}_${{ github.event.inputs.target_os }}"
|
||||
ARCHITECTURE: "amd64"
|
||||
steps:
|
||||
- name: "Set up repository"
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0 # Required because of release/get_version.py
|
||||
- name: Log in to Docker Hub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
- name: Check if specified image is already pushed
|
||||
run: |
|
||||
if [[ $FORCE_RELEASE = true ]]; then
|
||||
EXISTS=1
|
||||
else
|
||||
EXISTS=$(docker manifest inspect $DOCKER_ORG/$DOCKER_REPO:$DOCKER_IMAGE_TAG > /dev/null; echo $?)
|
||||
fi
|
||||
if [[ $EXISTS -eq 0 ]]; then
|
||||
echo "Image $DOCKER_ORG/$DOCKER_REPO:$DOCKER_IMAGE_TAG already exists, skipping next step ..."
|
||||
fi
|
||||
echo "EXISTS=$EXISTS" >> $GITHUB_ENV
|
||||
- name: "Build and publish image"
|
||||
if: env.EXISTS == 1
|
||||
run: |
|
||||
echo "Building and publishing $DOCKER_ORG/$DOCKER_REPO:$DOCKER_IMAGE_TAG"
|
||||
./release/package/run.sh build ${{ github.event.inputs.toolchain_version }} ${{ github.event.inputs.target_os }} $ARCHITECTURE --publish
|
||||
|
||||
arm_build:
|
||||
if: ${{ !startsWith(github.event.inputs.target_os, 'all') && endsWith(github.event.inputs.target_os, '-arm') }}
|
||||
name: "Build and publish specific arm image"
|
||||
runs-on: [self-hosted, DockerMgBuild, ARM64, strange]
|
||||
env:
|
||||
DOCKER_ORG: "memgraph"
|
||||
DOCKER_REPO: "memgraph-builder"
|
||||
DOCKER_IMAGE_TAG: "${{ github.event.inputs.toolchain_version }}_${{ github.event.inputs.target_os }}"
|
||||
ARCHITECTURE: "arm64"
|
||||
steps:
|
||||
- name: "Set up repository"
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0 # Required because of release/get_version.py
|
||||
- name: "Unlock keychain for current session" # Required beacuse ARM builds run on macos
|
||||
run: security -v unlock-keychain -p ${{ secrets.SELF_HOSTED_RUNNER_PASSWORD }} ~/Library/Keychains/login.keychain-db
|
||||
- name: Log in to Docker Hub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
- name: Check if specified image is already pushed
|
||||
run: |
|
||||
if [[ $FORCE_RELEASE = true ]]; then
|
||||
EXISTS=1
|
||||
else
|
||||
EXISTS=$(docker manifest inspect $DOCKER_ORG/$DOCKER_REPO:$DOCKER_IMAGE_TAG > /dev/null; echo $?)
|
||||
fi
|
||||
if [[ $EXISTS -eq 0 ]]; then
|
||||
echo "Image $DOCKER_ORG/$DOCKER_REPO:$DOCKER_IMAGE_TAG already exists, skipping next step ..."
|
||||
fi
|
||||
echo "EXISTS=$EXISTS" >> $GITHUB_ENV
|
||||
- name: "Build and publish image"
|
||||
if: env.EXISTS == 1
|
||||
run: |
|
||||
echo "Building and publishing $DOCKER_ORG/$DOCKER_REPO:$DOCKER_IMAGE_TAG"
|
||||
./release/package/run.sh build ${{ github.event.inputs.toolchain_version }} ${{ github.event.inputs.target_os }} $ARCHITECTURE --publish
|
||||
|
||||
all_amd_build:
|
||||
if: ${{ github.event.inputs.target_os == 'all-amd64' || github.event.inputs.target_os == 'all'}}
|
||||
name: "Build and publish all amd64 images"
|
||||
runs-on: [self-hosted, DockerMgBuild, X64]
|
||||
strategy:
|
||||
matrix:
|
||||
target_os: [amzn-2, centos-7, centos-9, debian-10, debian-11, fedora-36, ubuntu-18_04, ubuntu-20_04, ubuntu-22_04]
|
||||
env:
|
||||
DOCKER_ORG: "memgraph"
|
||||
DOCKER_REPO: "memgraph-builder"
|
||||
DOCKER_IMAGE_TAG: "${{ github.event.inputs.toolchain_version }}_${{ github.event.inputs.target_os }}"
|
||||
ARCHITECTURE: "amd64"
|
||||
steps:
|
||||
- name: "Set up repository"
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0 # Required because of release/get_version.py
|
||||
- name: Log in to Docker Hub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
- name: Check if specified image is already pushed
|
||||
run: |
|
||||
if [[ $FORCE_RELEASE = true ]]; then
|
||||
EXISTS=1
|
||||
else
|
||||
EXISTS=$(docker manifest inspect $DOCKER_ORG/$DOCKER_REPO:$DOCKER_IMAGE_TAG > /dev/null; echo $?)
|
||||
fi
|
||||
if [[ $EXISTS -eq 0 ]]; then
|
||||
echo "Image $DOCKER_ORG/$DOCKER_REPO:$DOCKER_IMAGE_TAG already exists, skipping next step ..."
|
||||
fi
|
||||
echo "EXISTS=$EXISTS" >> $GITHUB_ENV
|
||||
- name: "Build and publish image"
|
||||
if: env.EXISTS == 1
|
||||
run: |
|
||||
echo "Building and publishing $DOCKER_ORG/$DOCKER_REPO:$DOCKER_IMAGE_TAG"
|
||||
./release/package/run.sh build ${{ github.event.inputs.toolchain_version }} ${{ github.event.inputs.target_os }} $ARCHITECTURE --publish
|
||||
|
||||
all_arm_build:
|
||||
if: ${{ github.event.inputs.target_os == 'all-arm' || github.event.inputs.target_os == 'all'}}
|
||||
name: "Build and publish all arm images"
|
||||
runs-on: [self-hosted, DockerMgBuild, ARM64, strange]
|
||||
strategy:
|
||||
matrix:
|
||||
target_os: [debian-11-arm, ubuntu-22_04-arm]
|
||||
env:
|
||||
DOCKER_ORG: "memgraph"
|
||||
DOCKER_REPO: "memgraph-builder"
|
||||
DOCKER_IMAGE_TAG: "${{ github.event.inputs.toolchain_version }}_${{ github.event.inputs.target_os }}"
|
||||
ARCHITECTURE: "arm64"
|
||||
steps:
|
||||
- name: "Set up repository"
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0 # Required because of release/get_version.py
|
||||
- name: "Unlock keychain for current session" # Required beacuse ARM builds run on macos
|
||||
run: security -v unlock-keychain -p ${{ secrets.SELF_HOSTED_RUNNER_PASSWORD }} ~/Library/Keychains/login.keychain-db
|
||||
- name: Log in to Docker Hub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
- name: Check if specified image is already pushed
|
||||
run: |
|
||||
if [[ $FORCE_RELEASE = true ]]; then
|
||||
EXISTS=1
|
||||
else
|
||||
EXISTS=$(docker manifest inspect $DOCKER_ORG/$DOCKER_REPO:$DOCKER_IMAGE_TAG > /dev/null; echo $?)
|
||||
fi
|
||||
if [[ $EXISTS -eq 0 ]]; then
|
||||
echo "Image $DOCKER_ORG/$DOCKER_REPO:$DOCKER_IMAGE_TAG already exists, skipping next step ..."
|
||||
fi
|
||||
echo "EXISTS=$EXISTS" >> $GITHUB_ENV
|
||||
- name: "Build and publish image"
|
||||
if: env.EXISTS == 1
|
||||
run: |
|
||||
echo "Building and publishing $DOCKER_ORG/$DOCKER_REPO:$DOCKER_IMAGE_TAG"
|
||||
./release/package/run.sh build ${{ github.event.inputs.toolchain_version }} ${{ github.event.inputs.target_os }} $ARCHITECTURE --publish
|
||||
@@ -10,15 +10,21 @@ SUPPORTED_OS=(
|
||||
fedora-36
|
||||
amzn-2
|
||||
)
|
||||
|
||||
SUPPORTED_TOOLCAHINS=(
|
||||
v4
|
||||
v5
|
||||
)
|
||||
SUPPORTED_BUILD_TYPES=(
|
||||
Debug
|
||||
Release
|
||||
RelWithDebInfo
|
||||
)
|
||||
|
||||
SUPPORTED_ARCHITECTURES=(
|
||||
amd64
|
||||
arm64
|
||||
)
|
||||
PROJECT_ROOT="$SCRIPT_DIR/../.."
|
||||
TOOLCHAIN_VERSION="toolchain-v4"
|
||||
TOOLCHAIN_VERSION="${TOOLCHAIN_VERSION:-toolchain-v4}"
|
||||
ACTIVATE_TOOLCHAIN="source /opt/${TOOLCHAIN_VERSION}/activate"
|
||||
HOST_OUTPUT_DIR="$PROJECT_ROOT/build/output"
|
||||
|
||||
@@ -30,6 +36,14 @@ print_help () {
|
||||
echo " Build types: ${SUPPORTED_BUILD_TYPES[*]}"
|
||||
exit 1
|
||||
}
|
||||
print_help_build () {
|
||||
echo "$0 build {toolchain_version} {os} {architecture} [--publish]"
|
||||
echo ""
|
||||
echo " Toolchain versions: ${SUPPORTED_TOOLCAHINS[*]}"
|
||||
echo " OSs: ${SUPPORTED_OS[*]}"
|
||||
echo " Architectures: ${SUPPORTED_ARCHITECTURES[*]}"
|
||||
exit 1
|
||||
}
|
||||
|
||||
make_package () {
|
||||
os="$1"
|
||||
@@ -187,15 +201,26 @@ case "$1" in
|
||||
|
||||
build)
|
||||
shift 1
|
||||
if [[ "$#" -ne 2 ]]; then
|
||||
print_help
|
||||
if [[ "$#" -lt 3 || "$#" -gt 4 ]]; then
|
||||
print_help_build
|
||||
fi
|
||||
# in the vX format, e.g. v5
|
||||
toolchain_version="$1"
|
||||
# a name of the os folder, e.g. ubuntu-22.04-arm
|
||||
os="$2"
|
||||
cd "$SCRIPT_DIR/$os"
|
||||
docker build -f Dockerfile --build-arg TOOLCHAIN_VERSION="toolchain-$toolchain_version" -t "memgraph/memgraph-builder:${toolchain_version}_$os" .
|
||||
# architecture for which the image will be built, e.g. linux/arm64
|
||||
architecture="$3"
|
||||
if [[ "$#" -eq 4 ]]; then
|
||||
if [[ "$4" == "--publish" ]]; then
|
||||
docker buildx build --file Dockerfile --build-arg TOOLCHAIN_VERSION="toolchain-$toolchain_version" --platform "linux/$architecture" --tag "memgraph/memgraph-builder:${toolchain_version}_$os" --push .
|
||||
else
|
||||
print_help_build
|
||||
exit
|
||||
fi
|
||||
else
|
||||
docker buildx build --file Dockerfile --build-arg TOOLCHAIN_VERSION="toolchain-$toolchain_version" --platform "linux/$architecture" --tag "memgraph/memgraph-builder:${toolchain_version}_$os" .
|
||||
fi
|
||||
;;
|
||||
|
||||
test)
|
||||
|
||||
Reference in New Issue
Block a user