Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable builds on arm-based (m1) platforms #322

Merged
merged 5 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ jobs:
cd docker && bash ./dockbuild.sh

- name: Build & Run Python Tests via Docker
run: cd docker && ./testall python
run: cd docker && ./testall -D python

- name: Build & Run Java Tests via Docker
run: cd docker && ./makedist java
run: cd docker && ./makedist -D java

- name: Build Angular Code
run: cd docker && ./makedist angular
run: cd docker && ./makedist -D angular

- name: Run Angular Tests
run: cd docker && ./testall angular
run: cd docker && ./testall -D angular

8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ jobs:
cd docker && bash ./dockbuild.sh

- name: Build & Run Python Tests via Docker
run: cd docker && ./testall python
run: cd docker && ./testall -D python

- name: Build & Run Java Tests via Docker
run: cd docker && ./makedist java
run: cd docker && ./makedist -D java

- name: Build Angular Code
run: cd docker && ./makedist angular
run: cd docker && ./makedist -D angular

- name: Run Angular Tests
run: cd docker && ./testall angular
run: cd docker && ./testall -D angular

2 changes: 1 addition & 1 deletion .github/workflows/python-source.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ jobs:
cd docker && bash ./dockbuild.sh python

- name: Run Unit Tests via Docker
run: cd docker && ./testall python
run: cd docker && ./testall -D python

8 changes: 4 additions & 4 deletions .github/workflows/testall.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ jobs:
cd docker && bash ./dockbuild.sh

- name: Build & Run Python Tests via Docker
run: cd docker && ./testall python
run: cd docker && ./testall -D python

- name: Test Java via Docker
run: cd docker && ./testall java
run: cd docker && ./testall -D java

- name: Build Angular Code
run: cd docker && ./makedist angular
run: cd docker && ./makedist -D angular

- name: Run Angular Tests
run: cd docker && ./testall angular
run: cd docker && ./testall -D angular
2 changes: 1 addition & 1 deletion angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
"jasmine-core": "~3.8.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "^6.3.16",
"karma-chrome-launcher": "~3.1.0",
"karma-chrome-launcher": "~3.2.0",
"karma-coverage-istanbul-reporter": "~2.0.0",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.6.0",
Expand Down
5 changes: 3 additions & 2 deletions docker/angtest/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ RUN set -ex; \
wget https://dl-ssl.google.com/linux/linux_signing_key.pub; \
apt-key add linux_signing_key.pub; \
apt-get update; \
apt-get install -y --no-install-recommends google-chrome-stable less; \
ln -s /usr/bin/google-chrome-stable /usr/bin/chrome
apt-get install -y --no-install-recommends chromium less; \
ln -s /usr/bin/chromium /usr/bin/chrome
ENV CHROME_BIN /usr/bin/chromium

ENTRYPOINT ["docker/angtest/entrypoint.sh"]
13 changes: 13 additions & 0 deletions docker/cacerts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
This directory contains non-standard CA certificates needed to build the docker
images.

Failures building the Docker containers defined in ../ due to SSL certificate
verification errors may be a consequence of your local network's firewall. In
particular, the firewall may be substituting external site certificates with
its own signed by a non-standard CA certficate (chain). If so, you can place
the necessary certificates into this directory; they will be passed into the
containers, allowing them to safely connect to those external sites.

Be sure the certificates are in PEM format and include a .crt file extension.

Do not remove this README file; doing so may cause a Docker build faiure.
3 changes: 3 additions & 0 deletions docker/dockbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ if { echo " $BUILD_IMAGES " | grep -qs " pdrtest "; }; then
docker build $BUILD_OPTS -t $PACKAGE_NAME/pdrtest pdrtest 2>&1 | logit
fi
if { echo " $BUILD_IMAGES " | grep -qs " pdrangular "; }; then
# install CA certs into containers that can use them
cp_ca_certs_to pdrangular

echo '+' docker build $BUILD_OPTS -t $PACKAGE_NAME/pdrangular pdrangular
docker build $BUILD_OPTS -t $PACKAGE_NAME/pdrangular pdrangular 2>&1
fi
Expand Down
24 changes: 16 additions & 8 deletions docker/pdrangular/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,23 @@ RUN apt-get update && \
apt-get install -y --no-install-recommends zip wget ca-certificates git xz-utils \
gnupg python

COPY cacerts/README.md cacerts/*.crt /usr/local/share/ca-certificates/
RUN update-ca-certificates
ENV NODE_EXTRA_CA_CERTS /etc/ssl/certs/ca-certificates.crt

ARG node_ver=v14.19.0
COPY node-sha256.txt /tmp
RUN cd /tmp && wget https://nodejs.org/dist/$node_ver/node-$node_ver-linux-x64.tar.xz \
&& sha256sum -c node-sha256.txt
RUN cd /usr/local && tar xJf /tmp/node-$node_ver-linux-x64.tar.xz \
&& ln -s node-$node_ver-linux-x64 node \
&& cd bin \
&& ln -s ../node/bin/node node \
&& ln -s ../node/bin/npm npm \
COPY node-*-sha256.txt /tmp/
RUN arch=`dpkg --print-architecture` && \
{ [ "$arch" != "amd64" ] || arch="x64"; } && echo $arch > /etc/plat-arch
RUN cd /tmp && arch=`cat /etc/plat-arch` \
&& wget https://nodejs.org/dist/$node_ver/node-$node_ver-linux-${arch}.tar.xz \
&& sha256sum -c node-${arch}-sha256.txt
RUN cd /usr/local && arch=`cat /etc/plat-arch` \
&& tar xJf /tmp/node-$node_ver-linux-${arch}.tar.xz \
&& ln -s node-$node_ver-linux-${arch} node \
&& cd bin \
&& ln -s ../node/bin/node node \
&& ln -s ../node/bin/npm npm \
&& ln -s ../node/bin/npx npx

ENV GOSU_VERSION 1.14
Expand Down
13 changes: 13 additions & 0 deletions docker/pdrangular/cacerts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
This directory contains non-standard CA certificates needed to build the docker
images.

Failures building the Docker containers defined in ../ due to SSL certificate
verification errors may be a consequence of your local network's firewall. In
particular, the firewall may be substituting external site certificates with
its own signed by a non-standard CA certficate (chain). If so, you can place
the necessary certificates into this directory; they will be passed into the
containers, allowing them to safely connect to those external sites.

Be sure the certificates are in PEM format and include a .crt file extension.

Do not remove this README file; doing so may cause a Docker build faiure.
1 change: 1 addition & 0 deletions docker/pdrangular/node-arm64-sha256.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
73224b331d2bb0f05fd2ff62d1c736460f12f8e8757e8afbbcdf11a7f1464da5 node-v14.19.0-linux-arm64.tar.xz
5 changes: 4 additions & 1 deletion docker/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ while [ "$1" != "" ]; do
-d|--docker-build)
dodockbuild=1
;;
-D|--no-docker-build)
dodockbuild=0
;;
--dist-dir)
shift
distdir="$1"
Expand Down Expand Up @@ -172,7 +175,7 @@ if [ -z "$dodockbuild" ]; then
fi
fi

[ -z "$dodockbuild" ] || {
[ "$dodockbuild" != "1" ] || {
echo '#' Building missing docker containers...
$execdir/dockbuild.sh
}
Expand Down
15 changes: 15 additions & 0 deletions oar-build/_dockbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,21 @@ function setup_build {
BUILD_OPTS=`collect_build_opts`
}

function cp_ca_certs_to {
# assuming we are in the docker dir
[ \! -d cacerts ] || {
crts=`compgen -G 'cacerts/*.crt' || true`
[ -z "$crts" ] || {
echo "${prog}: installing CA certs from docker/cacerts"
for cont in $@; do
mkdir -p $cont/cacerts
echo '+' cp $crts cacerts/README.md $cont/cacerts
cp $crts cacerts/README.md $cont/cacerts
done
}
}
}

function help {
helpfile=$OAR_BUILD_DIR/dockbuild_help.txt
[ -f "$OAR_DOCKER_DIR/dockbuild_help.txt" ] && \
Expand Down
37 changes: 37 additions & 0 deletions scripts/install_ca_certs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#! /bin/bash
#
# install_ca_certs.sh -- copy the specified CA certificates into this source so that they can be used
# to build the software via docker.
#
# usage: install_ca_certs.sh CA_CERT_FILE...
#
# where CA_CERT_FILE is a file path to a CA certificate to install
#
# This script helps address the problem with docker-based builds when run within a firewall that
# replaces external site certificates with ones signed by a non-standard CA, causing the retrieval
# of software dependencies to fail. This script is used by oar-docker's localbuild script to receive
# extra CA certificates that addresses such failures. Because localdeploy makes no assumptions about
# how this source code repository builds using docker, this script encapsulates that knowledge on
# behalf of localbuild.
#
# Note: if this repository does not require/support use of non-standard CA certificates, remove (or
# rename) this script.
#
set -e
prog=`basename $0`
execdir=`dirname $0`
[ "$execdir" = "" -o "$execdir" = "." ] && execdir=$PWD
basedir=`dirname $execdir`

cacertdir="$basedir/docker/cacerts"
[ -d "$cacertdir" ] || exit 0 # I guess we don't need the certs

crts=`echo $@ | sed -e 's/^ *//' -e 's/ *$//'`
[ -n "$crts" ] || {
print "${prog}: Missing cert file argument"
false
}

echo '+' cp $crts $cacertdir
cp $crts $cacertdir

Loading