Skip to content

Commit

Permalink
patch
Browse files Browse the repository at this point in the history
  • Loading branch information
lbr38 committed Aug 23, 2023
1 parent c57a845 commit 5eecf01
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,6 @@ jobs:
sudo curl -s -o /var/lib/repomanager/operations/pool/ci-delete.json https://raw.githubusercontent.com/lbr38/resources/main/ci/repomanager/operations/deb/ci-delete.json 2> /dev/null
sudo curl -s -o /var/lib/repomanager/operations/pool/ci-reconstruct.json https://raw.githubusercontent.com/lbr38/resources/main/ci/repomanager/operations/deb/ci-reconstruct.json 2> /dev/null
- name: Check repomanager dependencies
run: sudo /var/www/repomanager/bin/repomanager -d --package-type deb

- name: Set up permissions
run: sudo chown -R www-data:repomanager /var/www/repomanager /var/lib/repomanager /home/repo

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,6 @@ jobs:
curl -s -o /var/lib/repomanager/operations/pool/ci-delete.json https://raw.githubusercontent.com/lbr38/resources/main/ci/repomanager/operations/rpm/ci-delete.json 2> /dev/null
curl -s -o /var/lib/repomanager/operations/pool/ci-reconstruct.json https://raw.githubusercontent.com/lbr38/resources/main/ci/repomanager/operations/rpm/ci-reconstruct.json 2> /dev/null
- name: Check repomanager dependencies
run: sudo /var/www/repomanager/bin/repomanager -d --package-type rpm

- name: Set up permissions
run: sudo chown -R www-data:repomanager /var/www/repomanager /var/lib/repomanager /home/repo

Expand Down
99 changes: 99 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: Run operations on a deb repo (from an Ubuntu latest system)

on:
push:
branches: [ devel ]
pull_request:
push:
branches: [ stable ]

jobs:
run-operations:
runs-on: ubuntu-latest
container:
image: debian:11
options: --user root
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install dependencies packages
run: sudo apt-get install -y findutils iputils-ping git gnupg2 rpm librpmsign9 createrepo-c reprepro apt-utils curl ca-certificates apt-transport-https dnsutils xz-utils

- name: Setup PHP
run: sudo add-apt-repository ppa:ondrej/php -y
# uses: shivammathur/setup-php@v2
# with:
# php-version: '8.1'
# coverage: none

- name: Install PHP modules
run: sudo apt update && sudo apt-get install -y php8.1-fpm php8.1-cli php8.1-sqlite3 php8.1-xml php8.1-curl sqlite3

- name: Print PHP version
run: php --version

- name: Set up repomanager files & directories
run: |
sudo groupadd repomanager
sudo usermod -a -G repomanager www-data
sudo mkdir -p /home/repo
sudo mkdir -p /var/www/repomanager
sudo mkdir -p /var/lib/repomanager
sudo mkdir -p /var/lib/repomanager/backups
sudo mkdir -p /var/lib/repomanager/logs/main
sudo mkdir -p /var/lib/repomanager/configurations
sudo mkdir -p /var/lib/repomanager/operations/pool/
sudo mkdir -p /var/lib/repomanager/db
sudo mkdir -p /var/lib/repomanager/.gnupg
sudo cp -r $GITHUB_WORKSPACE/www/* /var/www/repomanager/
sudo cp $GITHUB_WORKSPACE/www/version /var/lib/repomanager/version.available
- name: Set up repomanager main config
run: |
sudo curl -s -L -o /var/lib/repomanager/db/repomanager.db https://github.com/lbr38/resources/raw/main/ci/repomanager/repomanager.db 2> /dev/null
sudo curl -s -L -o /var/lib/repomanager/db/repomanager-hosts.db https://github.com/lbr38/resources/raw/main/ci/repomanager/repomanager-hosts.db 2> /dev/null
sudo ls -l /var/lib/repomanager/configurations/
sudo ls -l /var/lib/repomanager/db/
- name: Download jobs
run: |
sudo curl -s -o /var/lib/repomanager/operations/pool/ci-mirror-repo.json https://raw.githubusercontent.com/lbr38/resources/main/ci/repomanager/operations/deb/ci-mirror-repo.json 2> /dev/null
sudo curl -s -o /var/lib/repomanager/operations/pool/ci-update-repo.json https://raw.githubusercontent.com/lbr38/resources/main/ci/repomanager/operations/deb/ci-update-repo.json 2> /dev/null
sudo curl -s -o /var/lib/repomanager/operations/pool/ci-duplicate-repo.json https://raw.githubusercontent.com/lbr38/resources/main/ci/repomanager/operations/deb/ci-duplicate-repo.json 2> /dev/null
sudo curl -s -o /var/lib/repomanager/operations/pool/ci-create-env.json https://raw.githubusercontent.com/lbr38/resources/main/ci/repomanager/operations/deb/ci-create-env.json 2> /dev/null
sudo curl -s -o /var/lib/repomanager/operations/pool/ci-delete.json https://raw.githubusercontent.com/lbr38/resources/main/ci/repomanager/operations/deb/ci-delete.json 2> /dev/null
sudo curl -s -o /var/lib/repomanager/operations/pool/ci-reconstruct.json https://raw.githubusercontent.com/lbr38/resources/main/ci/repomanager/operations/deb/ci-reconstruct.json 2> /dev/null
- name: Set up permissions
run: sudo chown -R www-data:repomanager /var/www/repomanager /var/lib/repomanager /home/repo

- name: Update database
run: |
sudo -u www-data php /var/www/repomanager/tools/initialize-database.php
sudo -u www-data php /var/www/repomanager/tools/update-database.php
- name: Run job - Mirror repo
#run: sudo -u www-data php /var/www/repomanager/operations/execute.php --id='ci-mirror-repo' || sleep 10; sudo cat /var/lib/repomanager/logs/main/lastlog.log; exit 1
run: sudo -u www-data php /var/www/repomanager/operations/execute.php --id='ci-mirror-repo'

- name: Print mirrored repo content
run: sudo ls -l /home/repo/debian/buster/contrib_pprd/pool/contrib/

- name: Run job - Update repo
run: sudo -u www-data php /var/www/repomanager/operations/execute.php --id='ci-update-repo'

- name: Run job - Duplicate repo
run: sudo -u www-data php /var/www/repomanager/operations/execute.php --id='ci-duplicate-repo'

- name: Print duplicated repo content
run: sudo ls -l /home/repo/debian-copy/buster/contrib_pprd/pool/contrib/

- name: Run job - Create repo env
run: sudo -u www-data php /var/www/repomanager/operations/execute.php --id='ci-create-env'

- name: Run job - Reconstruct repo
run: sudo -u www-data php /var/www/repomanager/operations/execute.php --id='ci-reconstruct'

- name: Run job - Delete repo
run: sudo -u www-data php /var/www/repomanager/operations/execute.php --id='ci-delete'
3 changes: 2 additions & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ ARG WWW_DIR="/var/www/repomanager"
ARG DATA_DIR="/var/lib/repomanager"
ARG REPOS_DIR="/home/repo"
ARG DEBIAN_FRONTEND=noninteractive
ARG env
ARG fqdn
ARG max_upload_size

Expand All @@ -34,7 +35,7 @@ RUN apt-get install nginx php8.1-fpm php8.1-cli php8.1-sqlite3 php8.1-xml php8.1
# Clone project in the container
RUN git clone https://github.com/lbr38/repomanager.git /tmp/repomanager
# For tests only
# RUN cd /tmp/repomanager && git checkout devel
RUN if [ "$env" == "devel" ]; then cd /tmp/repomanager && git checkout devel; fi

# SERVICES CONFIG

Expand Down
1 change: 1 addition & 0 deletions docker/docker-compose-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ services:
context: .
dockerfile: Dockerfile
args:
env: devel
fqdn: repomanager-dev.localhost
max_upload_size: 32M
restart: always
Expand Down
1 change: 1 addition & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ services:
context: .
dockerfile: Dockerfile
args:
env: prod
fqdn: repomanager.example.com
max_upload_size: 32M
restart: always
Expand Down

0 comments on commit 5eecf01

Please sign in to comment.