Skip to content

Commit

Permalink
Test AM package builds with Podman
Browse files Browse the repository at this point in the history
* Use podman-compose for testing Jammy and EL9 packages
* Allow triggering workflows manually
  • Loading branch information
replaceafill authored Jun 17, 2024
1 parent db013aa commit 78ba46d
Show file tree
Hide file tree
Showing 16 changed files with 304 additions and 157 deletions.
77 changes: 38 additions & 39 deletions .github/workflows/test-am-debs.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: Archivematica DEB Packages Test
on:
workflow_dispatch:
pull_request:
paths:
- "debs/jammy/archivematica/**"
Expand Down Expand Up @@ -86,56 +87,54 @@ jobs:
with:
name: repository-deb
path: ${{ github.workspace }}/debs/jammy/_deb_repository
- name: Install Vagrant
- name: "Upgrade crun (supports Ubuntu's systemd in the Dockerfile)"
run: |
wget -O- https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
sudo apt update && sudo apt install vagrant
- name: Install VirtualBox
run: |
wget -O- https://www.virtualbox.org/download/oracle_vbox_2016.asc | sudo gpg --yes --output /usr/share/keyrings/oracle-virtualbox-2016.gpg --dearmor
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/oracle-virtualbox-2016.gpg] https://download.virtualbox.org/virtualbox/debian jammy contrib" | sudo tee /etc/apt/sources.list.d/virtualbox.list
sudo apt update && sudo apt install virtualbox-7.0
- name: "Downgrade VirtualBox"
run: |
sudo apt-get purge virtualbox-7.0
wget -O /tmp/virtualbox-7.0_7.0.14-161095~Ubuntu~jammy_amd64.deb -L https://download.virtualbox.org/virtualbox/7.0.14/virtualbox-7.0_7.0.14-161095~Ubuntu~jammy_amd64.deb
sudo dpkg -i /tmp/virtualbox-7.0_7.0.14-161095~Ubuntu~jammy_amd64.deb
- name: Install the vagrant-vbguest plugin
run: |
vagrant plugin install vagrant-vbguest
- name: Update vbox networks
run: |
sudo mkdir -p /etc/vbox/
echo "* 192.168.33.0/24" | sudo tee -a /etc/vbox/networks.conf
- name: Start
run: |
vagrant up --no-provision
working-directory: ${{ github.workspace }}/debs/jammy-testing
- name: Install Guest Additions build dependencies
wget https://github.com/containers/crun/releases/download/1.15/crun-1.15-linux-amd64
sudo install crun-1.15-linux-amd64 /usr/bin/crun
rm crun-1.15-linux-amd64
- name: "Install Python"
uses: "actions/setup-python@v5"
with:
python-version: "3.10"
cache: "pip"
cache-dependency-path: |
debs/jammy-testing/requirements.txt
- name: "Cache the virtual environment"
id: "venv-cache"
uses: "actions/cache@v4"
with:
path: |
debs/jammy-testing/.venv/
key: "os-${{ runner.os }}-python_version-${{ env.python_version }}-hash-${{ hashFiles('debs/jammy-testing/requirements.txt') }}"
- name: "Set up the virtual environment"
if: "steps.venv-cache.outputs.cache-hit == false"
working-directory: "${{ github.workspace }}/debs/jammy-testing"
run: |
vagrant ssh -c 'sudo apt-get update -y'
vagrant ssh -c 'sudo apt-get install -y linux-headers-$(uname -r) build-essential dkms'
working-directory: ${{ github.workspace }}/debs/jammy-testing
- name: Stop
python3 -m venv .venv
.venv/bin/python -m pip install -r requirements.txt
- name: "Add virtual environment to PATH"
working-directory: "${{ github.workspace }}/debs/jammy-testing"
run:
echo "$PWD/.venv/bin" >> $GITHUB_PATH
- name: "Start the Compose environment"
working-directory: "${{ github.workspace }}/debs/jammy-testing"
env:
DOCKER_IMAGE_NAME: "ubuntu"
DOCKER_IMAGE_TAG: "22.04"
run: |
vagrant halt
podman-compose up --detach
- name: Install packages
working-directory: ${{ github.workspace }}/debs/jammy-testing
- name: Start and provision
run: |
vagrant up
working-directory: ${{ github.workspace }}/debs/jammy-testing
env:
PROVISION: yes
LOCAL_REPOSITORY: yes
podman-compose exec --env LOCAL_REPOSITORY="yes" --user ubuntu archivematica /am-packbuild/debs/jammy-testing/install.sh
- name: Test AM API - Get processing configurations
run: |
test $( \
curl \
--silent \
--header 'Authorization: ApiKey admin:apikey' \
--header 'Content-Type: application/json' \
'http://192.168.33.2/api/processing-configuration/' \
'http://localhost:8000/api/processing-configuration/' \
| jq -r '.processing_configurations == ["automated", "default"]' \
) == true
- name: Test SS API - Get pipeline count
Expand All @@ -145,6 +144,6 @@ jobs:
--silent \
--header 'Authorization: ApiKey admin:apikey' \
--header 'Content-Type: application/json' \
'http://192.168.33.2:8000/api/v2/pipeline/' \
'http://localhost:8001/api/v2/pipeline/' \
| jq -r '.meta.total_count == 1' \
) == true
79 changes: 38 additions & 41 deletions .github/workflows/test-am-rpms.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: Archivematica RPM Packages Test
on:
workflow_dispatch:
pull_request:
paths:
- "rpms/EL9/archivematica/**"
Expand Down Expand Up @@ -86,58 +87,54 @@ jobs:
with:
name: repository-rpm
path: ${{ github.workspace }}/rpms/EL9/_yum_repository
- name: Install Vagrant
- name: "Upgrade crun (supports Ubuntu's systemd in the Dockerfile)"
run: |
wget -O- https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
sudo apt update && sudo apt install vagrant
- name: Install VirtualBox
run: |
wget -O- https://www.virtualbox.org/download/oracle_vbox_2016.asc | sudo gpg --yes --output /usr/share/keyrings/oracle-virtualbox-2016.gpg --dearmor
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/oracle-virtualbox-2016.gpg] https://download.virtualbox.org/virtualbox/debian jammy contrib" | sudo tee /etc/apt/sources.list.d/virtualbox.list
sudo apt update && sudo apt install virtualbox-7.0
- name: "Downgrade VirtualBox"
run: |
sudo apt-get purge virtualbox-7.0
wget -O /tmp/virtualbox-7.0_7.0.14-161095~Ubuntu~jammy_amd64.deb -L https://download.virtualbox.org/virtualbox/7.0.14/virtualbox-7.0_7.0.14-161095~Ubuntu~jammy_amd64.deb
sudo dpkg -i /tmp/virtualbox-7.0_7.0.14-161095~Ubuntu~jammy_amd64.deb
- name: Install the vagrant-vbguest plugin
run: |
vagrant plugin install vagrant-vbguest
- name: Update vbox networks
run: |
sudo mkdir -p /etc/vbox/
echo "* 192.168.33.0/24" | sudo tee -a /etc/vbox/networks.conf
- name: Start
run: |
vagrant up --no-provision
working-directory: ${{ github.workspace }}/rpms/EL9-testing
- name: Install Guest Additions build dependencies
wget https://github.com/containers/crun/releases/download/1.15/crun-1.15-linux-amd64
sudo install crun-1.15-linux-amd64 /usr/bin/crun
rm crun-1.15-linux-amd64
- name: "Install Python"
uses: "actions/setup-python@v5"
with:
python-version: "3.10"
cache: "pip"
cache-dependency-path: |
rpms/EL9-testing/requirements.txt
- name: "Cache the virtual environment"
id: "venv-cache"
uses: "actions/cache@v4"
with:
path: |
rpms/EL9-testing/.venv/
key: "os-${{ runner.os }}-python_version-${{ env.python_version }}-hash-${{ hashFiles('rpms/EL9-testing/requirements.txt') }}"
- name: "Set up the virtual environment"
if: "steps.venv-cache.outputs.cache-hit == false"
working-directory: "${{ github.workspace }}/rpms/EL9-testing"
run: |
vagrant ssh -c 'sudo yum update -y && sudo yum upgrade -y'
vagrant ssh -c 'sudo yum install -y epel-release yum-utils'
vagrant ssh -c 'sudo yum-config-manager --enable crb'
vagrant ssh -c 'sudo yum install -y kernel-devel'
working-directory: ${{ github.workspace }}/rpms/EL9-testing
- name: Stop
python3 -m venv .venv
.venv/bin/python -m pip install -r requirements.txt
- name: "Add virtual environment to PATH"
working-directory: "${{ github.workspace }}/rpms/EL9-testing"
run:
echo "$PWD/.venv/bin" >> $GITHUB_PATH
- name: "Start the Compose environment"
working-directory: "${{ github.workspace }}/rpms/EL9-testing"
env:
DOCKER_IMAGE_NAME: "rockylinux"
DOCKER_IMAGE_TAG: "9"
run: |
vagrant halt
podman-compose up --detach
- name: Install packages
working-directory: ${{ github.workspace }}/rpms/EL9-testing
- name: Start and provision
run: |
vagrant up
working-directory: ${{ github.workspace }}/rpms/EL9-testing
env:
PROVISION: yes
LOCAL_REPOSITORY: yes
podman-compose exec --env LOCAL_REPOSITORY="yes" --user ubuntu archivematica /am-packbuild/rpms/EL9-testing/install.sh
- name: Test AM API - Get processing configurations
run: |
test $( \
curl \
--silent \
--header 'Authorization: ApiKey admin:apikey' \
--header 'Content-Type: application/json' \
'http://192.168.33.2:81/api/processing-configuration/' \
'http://localhost:8000/api/processing-configuration/' \
| jq -r '.processing_configurations == ["automated", "default"]' \
) == true
- name: Test SS API - Get pipeline count
Expand All @@ -147,6 +144,6 @@ jobs:
--silent \
--header 'Authorization: ApiKey admin:apikey' \
--header 'Content-Type: application/json' \
'http://192.168.33.2:8001/api/v2/pipeline/' \
'http://localhost:8001/api/v2/pipeline/' \
| jq -r '.meta.total_count == 1' \
) == true
1 change: 1 addition & 0 deletions debs/jammy-testing/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/.bundle
/.vagrant
/.venv
43 changes: 43 additions & 0 deletions debs/jammy-testing/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
ARG TARGET=server
ARG DOCKER_IMAGE_NAME=ubuntu
ARG DOCKER_IMAGE_TAG=22.04

FROM ubuntu:22.04 AS install_ubuntu_22.04

ENV DEBIAN_FRONTEND noninteractive

RUN set -ex \
&& apt-get update \
&& apt-get install -y \
curl \
dialog \
gnupg \
locales \
openssh-server \
rsync \
sudo \
&& apt-get clean

RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
ENV TZ=UTC

FROM install_${DOCKER_IMAGE_NAME}_${DOCKER_IMAGE_TAG} as server

RUN useradd --home-dir /home/ubuntu --system ubuntu

RUN mkdir -p /etc/sudoers.d/ && echo 'ubuntu ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers.d/ubuntu

RUN ln -snf /usr/share/zoneinfo/${TZ} /etc/localtime && echo ${TZ} > /etc/timezone

COPY --chown=ubuntu:ubuntu . /src

EXPOSE 22
EXPOSE 80
EXPOSE 8000

CMD [ "/sbin/init" ]

FROM ${TARGET}
63 changes: 51 additions & 12 deletions debs/jammy-testing/README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,59 @@
# Instructions

This Vagrant environment is based on the official Ubuntu 22.04 Vagrant box
`ubuntu/jammy64`.
## Software requirements

Provision the Vagrant box using our official repository:
- Podman
- crun >= 1.14.4
- Python 3

vagrant up
This environment has been tested with Podman 3.4.4 and podman-compose 1.1.0
and is based on the official `ubuntu:22.04` Docker image.

Alternatively, provision the box using the local repository (`../jammy`),
which needs to be previously built:
## Set up

# Build the packages and the local repo. Then create the box.
$ make -C ../jammy
$ LOCAL_REPOSITORY="yes" vagrant up
Create a virtual environment and activate it:

Once is up you should be able to access to the web interfaces:
```shell
python3 -m venv .venv
source .venv/bin/activate
```

- Access to Dashboard: http://192.168.33.2
- Access to Storage Service: http://192.168.33.2:8000
Install the Python requirements:

```shell
python3 -m pip install -r requirements.txt
```

## Starting the Compose environment

Start the Compose services:

```shell
podman-compose up --detach
```

## Test installing packages

Test packages from the published Archivematica repository:

```shell
podman-compose exec --user ubuntu archivematica /am-packbuild/debs/jammy-testing/install.sh
```

Alternatively, test using the local repository (`../jammy`), which needs to be
previously built:

```shell
make -C ../jammy
```

Test using the local repository:

```shell
podman-compose exec --env LOCAL_REPOSITORY="yes" --user ubuntu archivematica /am-packbuild/debs/jammy-testing/install.sh
```

Once installation finishes you should be able to access to the web interfaces:

- Access to Dashboard: <http://localhost:8000>
- Access to Storage Service: <http://localhost:8001>
25 changes: 0 additions & 25 deletions debs/jammy-testing/Vagrantfile

This file was deleted.

18 changes: 18 additions & 0 deletions debs/jammy-testing/compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: archivematica-jammy-testing

services:

archivematica:
build:
args:
DOCKER_IMAGE_NAME: "${DOCKER_IMAGE_NAME:-ubuntu}"
DOCKER_IMAGE_TAG: "${DOCKER_IMAGE_TAG:-22.04}"
TARGET: server
ports:
- "2222:22"
- "8000:80"
- "8001:8000"
volumes:
- ".:/src"
- "../../:/am-packbuild"
3 changes: 3 additions & 0 deletions debs/jammy-testing/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ sudo apt-get -o Acquire::AllowInsecureRepositories=true update
sudo apt-get -y upgrade

sudo apt-get install -y openjdk-8-jre-headless mysql-server
sudo systemctl daemon-reload
sudo service mysql restart
sudo systemctl enable mysql

if [ "${search_enabled}" == "true" ] ; then
curl -fsSL https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo gpg --dearmor -o /etc/apt/keyrings/elasticsearch-6.x.gpg
Expand Down
1 change: 1 addition & 0 deletions debs/jammy-testing/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
git+https://github.com/containers/podman-compose.git@2681566580b4eaadfc5e6000ad19e49e56006e2b#egg=podman-compose
1 change: 1 addition & 0 deletions rpms/EL9-testing/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/.bundle
/.vagrant
/.venv
Loading

0 comments on commit 78ba46d

Please sign in to comment.