Skip to content

Commit

Permalink
Setup source and binaries
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Carroll <[email protected]>
  • Loading branch information
mjcarroll committed Nov 15, 2022
1 parent d55c626 commit 6906d94
Show file tree
Hide file tree
Showing 3 changed files with 122 additions and 9 deletions.
88 changes: 88 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ jobs:
BASE_IMAGE_TAG=${{ matrix.base_image_tag }}
VCS_REF=${{ github.sha }}
GZ_DISTRO=none
GZ_INSTALL=base_only
imageName: "gz-${{ matrix.base_image_name }}"
tag: "${{ matrix.base_image_tag }}"

Expand Down Expand Up @@ -74,5 +75,92 @@ jobs:
BASE_IMAGE_TAG=${{ matrix.base_image_tag }}
VCS_REF=${{ github.sha }}
GZ_DISTRO=${{ matrix.gz_distro }}
GZ_INSTALL=deps_only
imageName: "gz-${{ matrix.base_image_name }}"
tag: "${{ matrix.gz_distro }}-${{ matrix.base_image_tag }}"

build_ubuntu_docker_image_gz_binary:
strategy:
fail-fast: false
matrix:
base_image_name: [ubuntu]
build_name: [citadel-bionic, fortress-bionic, fortress-focal, garden-focal, garden-jammy]
include:
- build_name: citadel-bionic
gz_distro: citadel
base_image_tag: bionic
- build_name: fortress-bionic
gz_distro: fortress
base_image_tag: bionic
- build_name: fortress-focal
gz_distro: fortress
base_image_tag: focal
- build_name: garden-focal
gz_distro: garden
base_image_tag: focal
- build_name: garden-jammy
gz_distro: garden
base_image_tag: jammy
name: "${{ matrix.base_image_name }}-${{ matrix.gz_distro }}-${{ matrix.base_image_tag }}-binary"
# always use latest linux worker, as it should not have any impact
# when it comes to building docker images.
runs-on: ubuntu-latest
steps:
- name: checkout repository
uses: actions/checkout@v2
- name: publish image
uses: matootie/[email protected]
with:
accessToken: ${{ secrets.ACCESS_TOKEN }}
containerRegistry: true
buildArgs: |
BASE_IMAGE_NAME=${{ matrix.base_image_name }}
BASE_IMAGE_TAG=${{ matrix.base_image_tag }}
VCS_REF=${{ github.sha }}
GZ_DISTRO=${{ matrix.gz_distro }}
GZ_INSTALL=binary
imageName: "gz-${{ matrix.base_image_name }}"
tag: "${{ matrix.gz_distro }}-${{ matrix.base_image_tag }}-binary"

build_ubuntu_docker_image_gz_source:
strategy:
fail-fast: false
matrix:
base_image_name: [ubuntu]
build_name: [citadel-bionic, fortress-bionic, fortress-focal, garden-focal, garden-jammy]
include:
- build_name: citadel-bionic
gz_distro: citadel
base_image_tag: bionic
- build_name: fortress-bionic
gz_distro: fortress
base_image_tag: bionic
- build_name: fortress-focal
gz_distro: fortress
base_image_tag: focal
- build_name: garden-focal
gz_distro: garden
base_image_tag: focal
- build_name: garden-jammy
gz_distro: garden
base_image_tag: jammy
name: "${{ matrix.base_image_name }}-${{ matrix.gz_distro }}-${{ matrix.base_image_tag }}-source"
# always use latest linux worker, as it should not have any impact
# when it comes to building docker images.
runs-on: ubuntu-latest
steps:
- name: checkout repository
uses: actions/checkout@v2
- name: publish image
uses: matootie/[email protected]
with:
accessToken: ${{ secrets.ACCESS_TOKEN }}
containerRegistry: true
buildArgs: |
BASE_IMAGE_NAME=${{ matrix.base_image_name }}
BASE_IMAGE_TAG=${{ matrix.base_image_tag }}
VCS_REF=${{ github.sha }}
GZ_DISTRO=${{ matrix.gz_distro }}
GZ_INSTALL=source
imageName: "gz-${{ matrix.base_image_name }}"
tag: "${{ matrix.gz_distro }}-${{ matrix.base_image_tag }}-source"
9 changes: 8 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ ARG VCS_REF
# The Gazebo distribution being targeted by this image
ARG GZ_DISTRO

# The type of install to perform. Base, Deps, Full, Source
# base_only - Only base image with dev tools installed for OS version
# deps_only - Base image plus all dependencies for a OS/GZ version
# binary - Install full collection for OS/GZ version
# source - Clone source for OS/GZ version
ARG GZ_INSTALL

# Additional APT packages to be installed
ARG EXTRA_APT_PACKAGES

Expand All @@ -36,7 +43,7 @@ LABEL org.label-schema.vendor="gazebosim.org"
LABEL org.opencontainers.image.source="https://github.com/gazebo-tooling/setup-gz-docker"

COPY setup-gz.sh /tmp/setup-gz.sh
RUN /tmp/setup-gz.sh "${GZ_DISTRO}" && rm -f /tmp/setup-gz.sh
RUN /tmp/setup-gz.sh "${GZ_DISTRO}" "${GZ_INSTALL}" && rm -f /tmp/setup-gz.sh
ENV LANG en_US.UTF-8
RUN for i in $(echo ${EXTRA_APT_PACKAGES} | tr ',' ' '); do \
apt-get install --yes --no-install-recommends "$i"; \
Expand Down
34 changes: 26 additions & 8 deletions setup-gz.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
set -euxo pipefail

readonly GZ_DISTRO=$1
readonly GZ_INSTALL=$2

EXCLUDE_APT="libignition|libsdformat|python3-ignition"

apt-get update
Expand Down Expand Up @@ -81,19 +83,35 @@ pip3 install --upgrade \
vcstool \
wheel

if [ "$GZ_DISTRO" != "none" ]; then
mkdir -p workspace/src
cd workspace
wget https://raw.githubusercontent.com/gazebo-tooling/gazebodistro/master/collection-$GZ_DISTRO.yaml
vcs import src < collection-$GZ_DISTRO.yaml
if [ "$GZ_INSTALL" == "base_only" ]; then
exit 0
fi

if [ "$GZ_DISTRO" == "none" ]; then
echo "GZ_DISTRO not set cannot continue"
exit 1
fi


ALL_PACKAGES=$( \
sort -u $(find . -iname 'packages-'$UBUNTU_VERSION'.apt' -o -iname 'packages.apt') | grep -Ev $EXCLUDE_APT | tr '\n' ' ')
mkdir -p workspace/src
cd workspace
wget https://raw.githubusercontent.com/gazebo-tooling/gazebodistro/master/collection-$GZ_DISTRO.yaml
vcs import src < collection-$GZ_DISTRO.yaml

ALL_PACKAGES=$( \
sort -u $(find . -iname 'packages-'$UBUNTU_VERSION'.apt' -o -iname 'packages.apt') | grep -Ev $EXCLUDE_APT | tr '\n' ' ')

DEBIAN_FRONTEND=noninteractive \
apt-get install --no-install-recommends --quiet --yes \
$ALL_PACKAGES

if [ "$GZ_INSTALL" == "binary" ]; then
DEBIAN_FRONTEND=noninteractive \
apt-get install --no-install-recommends --quiet --yes \
$ALL_PACKAGES
gz-$GZ_DISTRO
fi

if [ "$GZ_INSTALL" != "source" ]; then
cd .. && rm -rf workspace
fi

Expand Down

0 comments on commit 6906d94

Please sign in to comment.