-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
62 lines (56 loc) · 1.71 KB
/
.gitlab-ci.yml
File metadata and controls
62 lines (56 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# SPDX-FileCopyrightText: 2025 The Anon Kode Authors
# SPDX-License-Identifier: GPL-3.0-only
variables:
BUILDER_IMAGE: $CI_REGISTRY_IMAGE/usbip-auto-attach-builder:$CI_COMMIT_SHA
BUILD_OUTPUT_DIR: $CI_PROJECT_DIR/build
stages:
- build_image
- compile
build_docker_image:
stage: build_image
image: docker:20.10.16
services:
- docker:20.10.16-dind
variables:
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: "/certs"
before_script:
- echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" --password-stdin $CI_REGISTRY
script:
# Build image, passing GIT_COMMIT_SHA to get version info inside build
- docker build --build-arg CI_COMMIT_SHA=$CI_COMMIT_SHA -t $BUILDER_IMAGE .
- docker push $BUILDER_IMAGE
rules:
- if: '$CI_PIPELINE_SOURCE == "push"'
.compile_base:
stage: compile
image: $BUILDER_IMAGE
script:
# Need to ensure .git exists for git-versioner
# Ideally, the builder image stage would handle this better
# For now, initialize a dummy repo and fetch the required commit
- git init
- git remote add origin $CI_REPOSITORY_URL
- git fetch origin $CI_COMMIT_SHA
- git checkout $CI_COMMIT_SHA
# Run make, relies on automatic mount and workdir set by GitLab runner
- make $MAKE_TARGET
artifacts:
paths:
- $ARTIFACT_PATH
expire_in: 1 week
needs:
- job: build_docker_image
artifacts: false
rules:
- if: '$CI_PIPELINE_SOURCE == "push"'
compile_amd64:
extends: .compile_base
variables:
MAKE_TARGET: $(TARGET_AMD64)
ARTIFACT_PATH: build/x64/usbip-auto-attach
compile_arm64:
extends: .compile_base
variables:
MAKE_TARGET: $(TARGET_ARM64)
ARTIFACT_PATH: build/arm64/usbip-auto-attach