====== Gitlab ======
===== Query Gitlab Database =====
# Interactivly
gitlab-sql
# Query on Command line
gitlab-sql -c ""
==== Check Background Migrations from CLI ====
SELECT job_class_name
, table_name
, column_name
, job_arguments
FROM batched_background_migrations
WHERE status NOT IN(3, 6);
==== Check Pipelines ====
SELECT
p.id as pipeline_id,
pr.name as project_name,
pr.path as project_path,
p.ref,
p.status,
p.started_at
FROM
p_ci_pipelines p
JOIN
projects pr ON p.project_id = pr.id
-- WHERE p.status IN ('pending', 'running')
ORDER BY
p.started_at DESC;
===== Garbage Collection Container Registry =====
gitlab-ctl registry-garbage-collect -m
===== CI/CD Multiplattform Build =====
==== Enable Binary Formats ====
$ docker run --rm --privileged tonistiigi/binfmt --install all
{
"supported": [
"linux/amd64",
"linux/arm64",
"linux/riscv64",
"linux/ppc64le",
"linux/s390x",
"linux/386",
"linux/arm/v7",
"linux/arm/v6"
],
"emulators": [
"qemu-aarch64",
"qemu-arm",
"qemu-ppc64le",
"qemu-riscv64",
"qemu-s390x"
]
}
==== Switch to buildx in .gitlab-ci.yml ====
Define CI_PLATFORMS variable in Settings / CI/CD:
CI_PLATFORMS = linux/amd64,linux/arm/v7,...
image: registry/docker-with-buildx
services:
- docker:dind
build:
stage: build
script:
- docker login -u $CI_USER -p $CI_TOKEN $CI_REGISTRY
- docker buildx create --use
- docker buildx build --platform $CI_PLATFORMS --push --pull -t $CI_REGISTRY_IMAGE .
{{tag>kb git}}