Commit 8db000de authored by Baudouin Feildel's avatar Baudouin Feildel
Browse files

Merge branch '1-create-one-ci-task-per-packet' into 'master'

Resolve "Create one CI job per packet"

Closes #1

See merge request !1
parents a52e975b 18ea9cde
Pipeline #309 passed with stages
in 74 minutes and 22 seconds
image: base/devel:latest
image: archlinux/base:latest
stages:
- docker
- build packages
- build repository
- deploy
build-packages:
stage: build
.build-package-template:
stage: build packages
image: amdg2/archlinux-base-devel:latest
artifacts:
paths:
- packages
expire_in: 2 days
before_script:
- pacman -Syu --noconfirm
# We update just update the database and we don't upgrade packages
- pacman -Syy --noconfirm
- 'echo "%wheel ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers'
- useradd -m -U -G "wheel" "aurtomatic"
script:
- sudo -u aurtomatic ./build.sh
- sudo -u aurtomatic ./build.sh "${PACKAGE_NAME}"
tags:
- executor:docker
docker-build-and-push:
stage: docker
image: bash
before_script:
- docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD
script:
- docker build -t amdg2/archlinux-base-devel .
- docker push amdg2/archlinux-base-devel
after_script:
- docker logout
tags:
- docker-build
# Packages
#######################################################################
build:bitwarden_rs:
extends: .build-package-template
variables:
PACKAGE_NAME: bitwarden_rs
allow_failure: true
build:dovecot2-antispam-git:
extends: .build-package-template
variables:
PACKAGE_NAME: dovecot2-antispam-git
build:mod_xsendfile:
extends: .build-package-template
variables:
PACKAGE_NAME: mod_xsendfile
build:parsoid:
extends: .build-package-template
variables:
PACKAGE_NAME: parsoid
build:pgpointcloud:
extends: .build-package-template
variables:
PACKAGE_NAME: pgpointcloud
build:pgsql-ogr-fdw:
extends: .build-package-template
variables:
PACKAGE_NAME: pgsql-ogr-fdw
build:php-imagick:
extends: .build-package-template
variables:
PACKAGE_NAME: php-imagick
build:php-redis:
extends: .build-package-template
variables:
PACKAGE_NAME: php-redis
build:php-systemd:
extends: .build-package-template
variables:
PACKAGE_NAME: php-systemd
build:postgis-old-upgrade:
extends: .build-package-template
variables:
PACKAGE_NAME: postgis-old-upgrade
build:prometheus-mysqld-exporter-bin:
extends: .build-package-template
variables:
PACKAGE_NAME: prometheus-mysqld-exporter-bin
build:prometheus-redis-exporter:
extends: .build-package-template
variables:
PACKAGE_NAME: prometheus-redis-exporter
build:rbenv:
extends: .build-package-template
variables:
PACKAGE_NAME: rbenv
build:rspamd:
extends: .build-package-template
variables:
PACKAGE_NAME: rspamd
allow_failure: true
build:yaourt:
extends: .build-package-template
variables:
PACKAGE_NAME: yaourt
#######################################################################
# End of Packages
generate-repository-database:
stage: build repository
image: amdg2/archlinux-base-devel:latest
artifacts:
paths:
- packages
expire_in: 2 days
script:
- repo-add "./packages/aurtomatic.db.tar.gz" "./packages/"*.pkg.tar.xz
tags:
- executor:docker
deploy:
stage: deploy
image: amdg2/archlinux-base-devel:latest
before_script:
- pacman -Syu --noconfirm
- pacman -S --noconfirm openssh
- mkdir -p ~/.ssh && touch ~/.ssh/known_hosts
- eval $(ssh-agent -s)
- test -f ~/.ssh/known_hosts || touch ~/.ssh/known_hosts
......@@ -31,4 +147,11 @@ deploy:
- ssh -p22 "$DEPLOY_USER@$DEPLOY_SERVER_ADDR" "rm -rf \"$DEPLOY_DIR.old\""
after_script:
- sed -i "s#^$DEPLOY_SERVER_ADDR $DEPLOY_SERVER_KEY\$##" ~/.ssh/known_hosts
only:
- master
environment:
name: repository
url: $REPOSITORY_URL
tags:
- executor:docker
FROM archlinux/base:latest
MAINTAINER Baudouin Feildel <baudouin@feildel.fr>
# Synchronize database and upgrade packages
RUN pacman -Syu --noconfirm
# Install common build dependencies and tools that will be needed by build script
RUN pacman -S --noconfirm base-devel grep tar sudo openssh git go php cunit nodejs npm python python2 cmake
CMD ["/usr/bin/bash"]
\ No newline at end of file
......@@ -123,21 +123,21 @@ build_package()
echo -e "${TITLE_FMT}==> Install make dependencies...${NO_FMT}"
for dep in $(package_get_makedepends)
do
install_dep_if_needed "$dep"
install_dep_if_needed "${dep}"
done
CURRENT_DEPENDENCY_TREE="$old_deps_tree (check)"
echo -e "${TITLE_FMT}==> Install check dependencies...${NO_FMT}"
for dep in $(package_get_checkdepends)
do
install_dep_if_needed "$dep"
install_dep_if_needed "${dep}"
done
CURRENT_DEPENDENCY_TREE="$old_deps_tree (runtime)"
echo -e "${TITLE_FMT}==> Install runtime dependencies...${NO_FMT}"
for dep in $(package_get_depends)
do
install_dep_if_needed "$dep"
install_dep_if_needed "${dep}"
done
CURRENT_DEPENDENCY_TREE="$old_deps_tree"
......@@ -151,6 +151,12 @@ build_package()
popd > /dev/null
}
if [[ -z "$1" ]]
then
echo "Error: package name not specified as first parameter."
exit 1
fi
if [[ ! -d "$WORKDIR" ]]
then
mkdir -p "$WORKDIR"
......@@ -161,14 +167,8 @@ then
mkdir -p "$SRCDIR/packages"
fi
for pkg in $(grep -P --invert-match "^\s*#" ./packages.list)
do
CURRENT_PACKAGE="$pkg"
CURRENT_DEPENDENCY_TREE="$pkg"
build_package "$pkg"
save_package "$pkg"
done
CURRENT_PACKAGE="$1"
CURRENT_DEPENDENCY_TREE="$1"
echo "${TITLE_FMT}==> Generating aurtomatic database${NO_FMT}"
repo-add "$SRCDIR/packages/aurtomatic.db.tar.gz" "$SRCDIR/packages/"*.pkg.tar.xz
\ No newline at end of file
build_package "$1"
save_package "$1"
\ No newline at end of file
#bitwarden_rs
dovecot2-antispam-git
mod_xsendfile
parsoid
pgpointcloud
pgsql-ogr-fdw
php-imagick
php-redis
php-systemd
postgis-old-upgrade
prometheus-mysqld-exporter-bin
prometheus-redis-exporter
rbenv
#rspamd
yaourt
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment