-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement AMAUATs test workflow with Podman
- Loading branch information
1 parent
e0d1976
commit 66ef76f
Showing
10 changed files
with
269 additions
and
208 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,57 +19,55 @@ on: | |
type: "string" | ||
jobs: | ||
test: | ||
name: "${{ matrix.feature }} / ${{ matrix.vagrant_box.label }}" | ||
name: "${{ matrix.feature }} / ${{ matrix.docker_image.label }}" | ||
runs-on: "ubuntu-latest" | ||
env: | ||
am_version: "${{ inputs.am_version }}" | ||
ss_version: "${{ inputs.ss_version }}" | ||
at_version: "${{ inputs.at_version }}" | ||
python_version: "3.9" | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
vagrant_box: | ||
- id: "rockylinux/9" | ||
docker_image: | ||
- name: "rockylinux" | ||
tag: "9" | ||
label: "rocky9" | ||
- id: "rockylinux/8" | ||
- name: "rockylinux" | ||
tag: "8" | ||
label: "rocky8" | ||
- id: "almalinux/9" | ||
- name: "almalinux" | ||
tag: "9" | ||
label: "alma9" | ||
- id: "ubuntu/jammy64" | ||
- name: "ubuntu" | ||
tag: "22.04" | ||
label: "jammy" | ||
feature: | ||
- "aip-encryption-mirror" | ||
# - "aip-encryption-mirror" | ||
- "aip-encryption" | ||
- "checksum" | ||
# - "checksum" | ||
- "create-aip" | ||
- "description-rights" | ||
- "extract-package" | ||
# - "description-rights" | ||
# - "extract-package" | ||
- "ingest-mkv-conformance" | ||
- "ingest-policy-check" | ||
- "metadata-xml" | ||
- "reingest-aip" | ||
- "transfer-microservices" | ||
- "transfer-mkv-conformance" | ||
# - "ingest-policy-check" | ||
# - "metadata-xml" | ||
# - "reingest-aip" | ||
# - "transfer-microservices" | ||
# - "transfer-mkv-conformance" | ||
- "transfer-policy-check" | ||
- "uuids-for-directories" | ||
- "virus" | ||
# - "uuids-for-directories" | ||
# - "virus" | ||
browser: | ||
- "Chrome" | ||
steps: | ||
- name: "Check out code" | ||
uses: "actions/checkout@v4" | ||
- name: "Check out AM code" | ||
uses: "actions/checkout@v4" | ||
with: | ||
repository: "artefactual/archivematica" | ||
ref: "${{ env.am_version }}" | ||
path: "${{ github.workspace }}/AM" | ||
- name: "Check out SS code" | ||
uses: "actions/checkout@v4" | ||
with: | ||
repository: "artefactual/archivematica-storage-service" | ||
ref: "${{ env.ss_version }}" | ||
path: "${{ github.workspace }}/SS" | ||
- name: "Upgrade crun (supports Ubuntu's systemd in the Dockerfile)" | ||
run: | | ||
wget https://github.com/containers/crun/releases/download/1.14.4/crun-1.14.4-linux-amd64 | ||
sudo install crun-1.14.4-linux-amd64 /usr/bin/crun | ||
rm crun-1.14.4-linux-amd64 | ||
- name: "Check out AMAUATs code" | ||
uses: "actions/checkout@v4" | ||
with: | ||
|
@@ -79,51 +77,65 @@ jobs: | |
- name: "Install Python" | ||
uses: "actions/setup-python@v5" | ||
with: | ||
python-version: "3.9" | ||
- name: "Install Vagrant" | ||
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" | ||
python-version: "${{ env.python_version }}" | ||
cache: "pip" | ||
cache-dependency-path: | | ||
tests/archivematica-acceptance-tests/requirements.txt | ||
- name: "Cache the virtual environment" | ||
id: "venv-cache" | ||
uses: "actions/cache@v4" | ||
with: | ||
path: | | ||
tests/archivematica-acceptance-tests/.venv/ | ||
key: "os-${{ runner.os }}-python_version-${{ env.python_version }}-hash-${{ hashFiles('tests/archivematica-acceptance-tests/requirements.txt') }}" | ||
- name: "Set up the virtual environment" | ||
if: "steps.venv-cache.outputs.cache-hit == false" | ||
working-directory: "${{ github.workspace }}/tests/archivematica-acceptance-tests" | ||
run: | | ||
vagrant plugin install vagrant-vbguest | ||
- name: "Update the VirtualBox networks file" | ||
python3 -m venv .venv | ||
.venv/bin/python -m pip install -r requirements.txt | ||
- name: "Add virtual environment to PATH" | ||
working-directory: "${{ github.workspace }}/tests/archivematica-acceptance-tests" | ||
run: | ||
echo "$PWD/.venv/bin" >> $GITHUB_PATH | ||
- name: "Generate an SSH key and copy it next to the Dockerfile" | ||
run: | | ||
sudo mkdir -p /etc/vbox/ | ||
echo "* 192.168.33.0/24" | sudo tee -a /etc/vbox/networks.conf | ||
- name: "Start the VM" | ||
mkdir $HOME/.ssh | ||
ssh-keygen -t rsa -f $HOME/.ssh/id_rsa -N "" | ||
cp $HOME/.ssh/id_rsa.pub ${{ github.workspace }}/tests/archivematica-acceptance-tests/ssh_pub_key | ||
- name: "Start the Compose environment" | ||
working-directory: "${{ github.workspace }}/tests/archivematica-acceptance-tests" | ||
env: | ||
VAGRANT_BOX: "${{ matrix.vagrant_box.id }}" | ||
DOCKER_IMAGE_NAME: "${{ matrix.docker_image.name }}" | ||
DOCKER_IMAGE_TAG: "${{ matrix.docker_image.tag }}" | ||
run: | | ||
vagrant up | ||
podman-compose up --detach | ||
- name: "Install Archivematica" | ||
working-directory: "${{ github.workspace }}/tests/archivematica-acceptance-tests" | ||
env: | ||
ANSIBLE_HOST_KEY_CHECKING: "False" | ||
ANSIBLE_REMOTE_PORT: 2222 | ||
run: | | ||
ansible-galaxy install -f -p roles/ -r requirements.yml | ||
ansible-playbook -i 192.168.33.2, playbook.yml \ | ||
-u vagrant \ | ||
--private-key ${{ github.workspace }}/tests/archivematica-acceptance-tests/.vagrant/machines/default/virtualbox/private_key \ | ||
ansible-playbook -i localhost, playbook.yml \ | ||
-u ubuntu \ | ||
-e "archivematica_src_am_version=${{ env.am_version }} archivematica_src_ss_version=${{ env.ss_version }}" \ | ||
-v | ||
- name: "Prepare the VM for running the AMAUATs" | ||
-vvv | ||
- name: "Prepare the container for running the AMAUATs" | ||
working-directory: "${{ github.workspace }}/tests/archivematica-acceptance-tests" | ||
run: | | ||
vagrant ssh -c 'sudo usermod -a -G archivematica vagrant' | ||
vagrant ssh -c 'sudo ln -s /home/vagrant /home/archivematica' | ||
podman-compose exec --user root archivematica usermod -a -G archivematica ubuntu | ||
podman-compose exec --user root archivematica ln -s /home/ubuntu /home/archivematica | ||
- name: "Call an Archivematica API endpoint" | ||
run: | | ||
curl \ | ||
--header "Authorization: ApiKey admin:this_is_the_am_api_key" \ | ||
http://localhost:8000/api/processing-configuration/ | ||
- name: "Call a Storage Service API endpoint" | ||
run: | | ||
curl \ | ||
--header "Authorization: ApiKey admin:this_is_the_ss_api_key" \ | ||
http://localhost:8001/api/v2/pipeline/ | ||
- name: "Set up AMAUATs" | ||
working-directory: "${{ github.workspace }}/AMAUATs" | ||
run: | | ||
|
@@ -145,47 +157,47 @@ jobs: | |
-D driver_name=${{ matrix.browser }} \ | ||
-D am_username=admin \ | ||
-D am_password=archivematica \ | ||
-D am_url=http://192.168.33.2/ \ | ||
-D am_url=http://localhost:8000/ \ | ||
-D am_api_key="this_is_the_am_api_key" \ | ||
-D ss_username=admin \ | ||
-D ss_password=archivematica \ | ||
-D ss_api_key="this_is_the_ss_api_key" \ | ||
-D ss_url=http://192.168.33.2:8000/ \ | ||
-D home=vagrant \ | ||
-D server_user=vagrant \ | ||
-D transfer_source_path=/home/vagrant/archivematica-sampledata/TestTransfers/acceptance-tests \ | ||
-D ssh_identity_file=${{ github.workspace }}/tests/archivematica-acceptance-tests/.vagrant/machines/default/virtualbox/private_key | ||
- name: "Save common logs on failure" | ||
if: "${{ (failure() && steps.amauat-run.outcome == 'failure') || (cancelled() && steps.amauat-run.outcome == 'cancelled') }}" | ||
working-directory: "${{ github.workspace }}/tests/archivematica-acceptance-tests" | ||
run: | | ||
mkdir /tmp/logs | ||
vagrant ssh -c 'mkdir -p /tmp/logs/journalctl' | ||
vagrant ssh -c 'sudo journalctl -u archivematica-mcp-client --no-pager > /tmp/logs/journalctl/archivematica-mcp-client' | ||
- name: "Save logs on failure" | ||
if: "${{ startsWith(matrix.vagrant_box.id, 'ubuntu/') && ((failure() && steps.amauat-run.outcome == 'failure') || (cancelled() && steps.amauat-run.outcome == 'cancelled')) }}" | ||
working-directory: "${{ github.workspace }}/tests/archivematica-acceptance-tests" | ||
run: | | ||
vagrant ssh -c 'sudo cp -r /var/log/{archivematica,mysql,elasticsearch,gearman-job-server,clamav,nginx} /tmp/logs' | ||
- name: "Save logs on failure" | ||
if: "${{ (startsWith(matrix.vagrant_box.id, 'rockylinux/') || startsWith(matrix.vagrant_box.id, 'almalinux/')) && ((failure() && steps.amauat-run.outcome == 'failure') || (cancelled() && steps.amauat-run.outcome == 'cancelled')) }}" | ||
working-directory: "${{ github.workspace }}/tests/archivematica-acceptance-tests" | ||
run: | | ||
vagrant ssh -c 'sudo journalctl -u clamd@scan --no-pager > /tmp/logs/journalctl/clamd' | ||
vagrant ssh -c 'sudo cp -r /var/log/{archivematica,mysqld.log,elasticsearch,nginx} /tmp/logs' | ||
- name: "Copy logs from VM" | ||
if: "${{ (failure() && steps.amauat-run.outcome == 'failure') || (cancelled() && steps.amauat-run.outcome == 'cancelled') }}" | ||
working-directory: "${{ github.workspace }}/tests/archivematica-acceptance-tests" | ||
run: | | ||
vagrant ssh -c 'sudo chown -R vagrant /tmp/logs' | ||
scp \ | ||
-i ${{ github.workspace }}/tests/archivematica-acceptance-tests/.vagrant/machines/default/virtualbox/private_key \ | ||
-o "StrictHostKeyChecking=no" \ | ||
-r \ | ||
[email protected]:/tmp/logs /tmp/logs | ||
- name: "Upload logs on failure" | ||
if: "${{ (failure() && steps.amauat-run.outcome == 'failure') || (cancelled() && steps.amauat-run.outcome == 'cancelled') }}" | ||
uses: "actions/upload-artifact@v4" | ||
with: | ||
name: "logs-${{ matrix.vagrant_box.label }}-${{ matrix.feature }}" | ||
path: "/tmp/logs" | ||
-D ss_url=http://localhost:8001/ \ | ||
-D home=ubuntu \ | ||
-D server_user=ubuntu \ | ||
-D transfer_source_path=/home/ubuntu/archivematica-sampledata/TestTransfers/acceptance-tests \ | ||
-D ssh_identity_file=$HOME/.ssh/id_rsa | ||
# - name: "Save common logs on failure" | ||
# if: "${{ (failure() && steps.amauat-run.outcome == 'failure') || (cancelled() && steps.amauat-run.outcome == 'cancelled') }}" | ||
# working-directory: "${{ github.workspace }}/tests/archivematica-acceptance-tests" | ||
# run: | | ||
# mkdir /tmp/logs | ||
# vagrant ssh -c 'mkdir -p /tmp/logs/journalctl' | ||
# vagrant ssh -c 'sudo journalctl -u archivematica-mcp-client --no-pager > /tmp/logs/journalctl/archivematica-mcp-client' | ||
# - name: "Save logs on failure" | ||
# if: "${{ startsWith(matrix.vagrant_box.id, 'ubuntu/') && ((failure() && steps.amauat-run.outcome == 'failure') || (cancelled() && steps.amauat-run.outcome == 'cancelled')) }}" | ||
# working-directory: "${{ github.workspace }}/tests/archivematica-acceptance-tests" | ||
# run: | | ||
# vagrant ssh -c 'sudo cp -r /var/log/{archivematica,mysql,elasticsearch,gearman-job-server,clamav,nginx} /tmp/logs' | ||
# - name: "Save logs on failure" | ||
# if: "${{ (startsWith(matrix.vagrant_box.id, 'rockylinux/') || startsWith(matrix.vagrant_box.id, 'almalinux/')) && ((failure() && steps.amauat-run.outcome == 'failure') || (cancelled() && steps.amauat-run.outcome == 'cancelled')) }}" | ||
# working-directory: "${{ github.workspace }}/tests/archivematica-acceptance-tests" | ||
# run: | | ||
# vagrant ssh -c 'sudo journalctl -u clamd@scan --no-pager > /tmp/logs/journalctl/clamd' | ||
# vagrant ssh -c 'sudo cp -r /var/log/{archivematica,mysqld.log,elasticsearch,nginx} /tmp/logs' | ||
# - name: "Copy logs from VM" | ||
# if: "${{ (failure() && steps.amauat-run.outcome == 'failure') || (cancelled() && steps.amauat-run.outcome == 'cancelled') }}" | ||
# working-directory: "${{ github.workspace }}/tests/archivematica-acceptance-tests" | ||
# run: | | ||
# vagrant ssh -c 'sudo chown -R vagrant /tmp/logs' | ||
# scp \ | ||
# -i ${{ github.workspace }}/tests/archivematica-acceptance-tests/.vagrant/machines/default/virtualbox/private_key \ | ||
# -o "StrictHostKeyChecking=no" \ | ||
# -r \ | ||
# [email protected]:/tmp/logs /tmp/logs | ||
# - name: "Upload logs on failure" | ||
# if: "${{ (failure() && steps.amauat-run.outcome == 'failure') || (cancelled() && steps.amauat-run.outcome == 'cancelled') }}" | ||
# uses: "actions/upload-artifact@v4" | ||
# with: | ||
# name: "logs-${{ matrix.vagrant_box.label }}-${{ matrix.feature }}" | ||
# path: "/tmp/logs" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
ssh_pub_key | ||
.venv | ||
roles |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
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 \ | ||
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 | ||
|
||
FROM rockylinux:8 AS install_rockylinux_8 | ||
|
||
RUN set -ex \ | ||
&& dnf -y update \ | ||
&& dnf -y install coreutils --allowerasing \ | ||
&& dnf -y install \ | ||
glibc-langpack-en \ | ||
openssh-server \ | ||
sudo \ | ||
&& dnf clean all | ||
|
||
FROM rockylinux:9 AS install_rockylinux_9 | ||
|
||
RUN set -ex \ | ||
&& dnf -y update \ | ||
&& dnf -y install coreutils --allowerasing \ | ||
&& dnf -y install \ | ||
glibc-langpack-en \ | ||
openssh-server \ | ||
python-unversioned-command \ | ||
sudo \ | ||
&& dnf clean all | ||
|
||
FROM almalinux:9 AS install_almalinux_9 | ||
|
||
RUN set -ex \ | ||
&& dnf -y update \ | ||
&& dnf -y install coreutils --allowerasing \ | ||
&& dnf -y install \ | ||
glibc-langpack-en \ | ||
openssh-server \ | ||
python-unversioned-command \ | ||
sudo \ | ||
&& dnf clean all | ||
|
||
FROM install_${DOCKER_IMAGE_NAME}_${DOCKER_IMAGE_TAG} as server | ||
|
||
RUN useradd --home-dir /home/ubuntu --system ubuntu | ||
|
||
COPY --chown=ubuntu:ubuntu --chmod=600 ssh_pub_key /home/ubuntu/.ssh/authorized_keys | ||
|
||
RUN mkdir -p /etc/sudoers.d/ && echo 'ubuntu ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers.d/ubuntu | ||
|
||
EXPOSE 22 | ||
EXPOSE 80 | ||
EXPOSE 8000 | ||
|
||
CMD [ "/sbin/init" ] | ||
|
||
FROM ${TARGET} |
Oops, something went wrong.