Skip to content

Commit 25cc19b

Browse files
committedMar 22, 2025
gitlab-runner: 17.2.0 -> 17.9.1
* Switch build invocations to make * Fix build errors on darwin
1 parent 0c84b25 commit 25cc19b

6 files changed

+140
-37
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
diff --git a/executors/kubernetes/kubernetes_test.go b/executors/kubernetes/kubernetes_test.go
2+
index ba50f31e0..c500e3a26 100644
3+
--- a/executors/kubernetes/kubernetes_test.go
4+
+++ b/executors/kubernetes/kubernetes_test.go
5+
@@ -2815,6 +2815,9 @@ func TestPrepare(t *testing.T) {
6+
if runtime.GOOS == "windows" {
7+
return false, "skipping test, because we are running on windows"
8+
}
9+
+ if runtime.GOARCH == "arm64" {
10+
+ return false, "skipping test, because of fix assertion we should be on x86"
11+
+ }
12+
return true, ""
13+
},
14+
WindowsKernelVersionGetter: func() string {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
diff --git a/commands/wrapper_test.go b/commands/wrapper_test.go
2+
index c897c8170..b5ad47acf 100644
3+
--- a/commands/wrapper_test.go
4+
+++ b/commands/wrapper_test.go
5+
@@ -16,10 +16,13 @@ import (
6+
func TestRunnerWrapperCommand_createListener(t *testing.T) {
7+
testSocketPath := filepath.Join(t.TempDir(), "test.sock")
8+
9+
- skipOnWindows := func(t *testing.T) {
10+
+ skipCondition := func(t *testing.T) {
11+
if runtime.GOOS == "windows" {
12+
t.Skip("Test doesn't work reliably on Windows (unix socket usage)")
13+
}
14+
+ if runtime.GOOS == "darwin" {
15+
+ t.Skip("Test doesn't work reliably on Darwin with enabled sandbox")
16+
+ }
17+
}
18+
19+
tests := map[string]struct {
20+
@@ -36,19 +39,19 @@ func TestRunnerWrapperCommand_createListener(t *testing.T) {
21+
},
22+
},
23+
"proper unix socket - unix://": {
24+
- skip: skipOnWindows,
25+
+ skip: skipCondition,
26+
grpcAddress: fmt.Sprintf("unix://%s", testSocketPath),
27+
expectedNetwork: "unix",
28+
expectedAddress: testSocketPath,
29+
},
30+
"proper unix socket - unix:": {
31+
- skip: skipOnWindows,
32+
+ skip: skipCondition,
33+
grpcAddress: fmt.Sprintf("unix://%s", testSocketPath),
34+
expectedNetwork: "unix",
35+
expectedAddress: testSocketPath,
36+
},
37+
"invalid unix socket": {
38+
- skip: skipOnWindows,
39+
+ skip: skipCondition,
40+
grpcAddress: fmt.Sprintf("unix:/%s", testSocketPath),
41+
assertError: func(t *testing.T, err error) {
42+
var eerr *net.OpError
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
diff --git a/helpers/certificate/x509_test.go b/helpers/certificate/x509_test.go
2+
index 8afe0d9e8..7eac8a691 100644
3+
--- a/helpers/certificate/x509_test.go
4+
+++ b/helpers/certificate/x509_test.go
5+
@@ -8,6 +8,7 @@ import (
6+
"net"
7+
"net/http"
8+
"regexp"
9+
+ "runtime"
10+
"testing"
11+
12+
"github.com/stretchr/testify/assert"
13+
@@ -62,6 +63,9 @@ func TestCertificate(t *testing.T) {
14+
_, err = client.Do(req)
15+
assert.Error(t, err)
16+
// Error messages provided by Linux and MacOS respectively.
17+
- const want = "certificate signed by unknown authority|certificate is not trusted"
18+
- assert.Regexp(t, regexp.MustCompile(want), err.Error())
19+
+ // Nix sandbox prevents the test from working
20+
+ if runtime.GOOS != "darwin" {
21+
+ const want = "certificate signed by unknown authority|certificate is not trusted"
22+
+ assert.Regexp(t, regexp.MustCompile(want), err.Error())
23+
+ }
24+
}

‎pkgs/by-name/gi/gitlab-runner/fix-shell-path.patch

-25
This file was deleted.

‎pkgs/by-name/gi/gitlab-runner/package.nix

+31-12
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
1-
{ lib, buildGoModule, fetchFromGitLab, bash }:
1+
{
2+
lib,
3+
buildGoModule,
4+
fetchFromGitLab,
5+
bash,
6+
}:
27

38
let
4-
version = "17.2.0";
9+
version = "17.9.1";
510
in
611
buildGoModule rec {
712
inherit version;
813
pname = "gitlab-runner";
914

10-
commonPackagePath = "gitlab.com/gitlab-org/gitlab-runner/common";
11-
ldflags = [
12-
"-X ${commonPackagePath}.NAME=gitlab-runner"
13-
"-X ${commonPackagePath}.VERSION=${version}"
14-
"-X ${commonPackagePath}.REVISION=v${version}"
15-
];
16-
1715
# For patchShebangs
1816
buildInputs = [ bash ];
1917

20-
vendorHash = "sha256-1MwHss76apA9KoFhEU6lYiUACrPMGYzjhds6nTyNuJI=";
18+
vendorHash = "sha256-t/FVaDga2ogyqgVdJuBMSyls3rricfqIy5bFSH4snk4=";
2119

2220
src = fetchFromGitLab {
2321
owner = "gitlab-org";
2422
repo = "gitlab-runner";
2523
rev = "v${version}";
26-
hash = "sha256-a2Igy4DS3fYTvPW1vvDrH/DjMQ4lG9cm/P3mFr+y9s4=";
24+
hash = "sha256-FGE/CVnf73u3w8Czb+NzS2qXf5OQPFI8ksTf0pKV7UY=";
2725
};
2826

2927
patches = [
30-
./fix-shell-path.patch
28+
./disable-kubernetes-test-on-darwin.patch
29+
./disable-unix-socket-tests-on-darwin.patch
30+
./disable-x509-certificate-check.patch
3131
./remove-bash-test.patch
3232
];
3333

@@ -50,13 +50,26 @@ buildGoModule rec {
5050
rm executors/docker/services_test.go
5151
'';
5252

53+
postPatch = ''
54+
substituteInPlace Makefile --replace-fail "export VERSION := \$(shell ./ci/version)" "export VERSION := ${version}"
55+
substituteInPlace Makefile --replace-fail "REVISION := \$(shell git rev-parse --short=8 HEAD || echo unknown)" "REVISION := v${version}"
56+
'';
57+
5358
excludedPackages = [
5459
# CI helper script for pushing images to Docker and ECR registries
5560
# https://gitlab.com/gitlab-org/gitlab-runner/-/merge_requests/4139
5661
"./scripts/sync-docker-images"
5762
];
5863

64+
buildPhase = ''
65+
runHook preBuild
66+
make -j $NIX_BUILD_CORES runner-and-helper-bin-host
67+
runHook postBuild
68+
'';
69+
5970
postInstall = ''
71+
mkdir $out/bin
72+
cp out/binaries/gitlab-runner-$GOOS-$GOARCH $out/bin/gitlab-runner
6073
install packaging/root/usr/share/gitlab-runner/clear-docker-cache $out/bin
6174
'';
6275

@@ -65,6 +78,12 @@ buildGoModule rec {
6578
export CI=0
6679
'';
6780

81+
checkPhase = ''
82+
runHook preCheck
83+
make simple-test
84+
runHook postCheck
85+
'';
86+
6887
meta = with lib; {
6988
description = "GitLab Runner the continuous integration executor of GitLab";
7089
license = licenses.mit;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
diff --git a/Makefile b/Makefile
2+
index e948db0d6d..cd0957251e 100644
3+
--- a/Makefile
4+
+++ b/Makefile
5+
@@ -3,14 +3,10 @@
6+
export PACKAGE_NAME ?= $(NAME)
7+
export VERSION := $(shell ./ci/version)
8+
REVISION := $(shell git rev-parse --short=8 HEAD || echo unknown)
9+
-BRANCH := $(shell git show-ref | grep "$(REVISION)" | grep -v HEAD | awk '{print $$2}' | sed 's|refs/remotes/origin/||' | sed 's|refs/heads/||' | sort | head -n 1)
10+
+BRANCH :=
11+
export TESTFLAGS ?= -cover
12+
13+
-LATEST_STABLE_TAG := $(shell git -c versionsort.prereleaseSuffix="-rc" -c versionsort.prereleaseSuffix="-RC" tag -l "v*.*.*" | sort -rV | awk '!/rc/' | head -n 1)
14+
export IS_LATEST :=
15+
-ifeq ($(shell git describe --exact-match --match $(LATEST_STABLE_TAG) >/dev/null 2>&1; echo $$?), 0)
16+
-export IS_LATEST := true
17+
-endif
18+
19+
PACKAGE_CLOUD ?= runner/gitlab-runner
20+
PACKAGE_CLOUD_URL ?= https://packages.gitlab.com
21+
@@ -32,7 +28,7 @@
22+
export MAIN_PACKAGE ?= gitlab.com/gitlab-org/gitlab-runner
23+
24+
GO_LDFLAGS ?= -X $(COMMON_PACKAGE_NAMESPACE).NAME=$(APP_NAME) -X $(COMMON_PACKAGE_NAMESPACE).VERSION=$(VERSION) \
25+
- -X $(COMMON_PACKAGE_NAMESPACE).BRANCH=$(BRANCH) \
26+
+ -X $(COMMON_PACKAGE_NAMESPACE).REVISION=$(REVISION) -X $(COMMON_PACKAGE_NAMESPACE).BRANCH=$(BRANCH) \
27+
-w
28+
29+
GO_TEST_LDFLAGS ?= -X $(COMMON_PACKAGE_NAMESPACE).NAME=$(APP_NAME)

0 commit comments

Comments
 (0)
Failed to load comments.