Skip to content

Commit ac195f9

Browse files
adrianrioboclaude
andcommitted
feat(ibmcloud): add GitLab runner support for IBM Power and IBM Z
- Register GitLab project or group runners via Pulumi NewUserRunner API during stack provisioning; auth token flows through ApplyT to avoid global state mutation - Add --glrunner-unsecure flag (default false): by default a locked-down gitlab-runner system user is created with rootless-Podman support (subuid/subgid + loginctl enable-linger); when true the runner runs as the default OS user - Create gitlab-runner system user with /bin/bash shell so PAM does not reject su calls from the shell executor (nologin caused immediate 'prepare environment: exit status 1') - Install and configure otelcol-contrib filelog collector for syslog, secure/auth, audit, and gitlab-runner log shipping via OTLP HTTP; use apt-get/dnf for installation to resolve package dependencies automatically - Exclude otel-endpoint from partial-config validation since it carries a default value; only validate app-code, auth-token, and index - Upgrade pulumi-gitlab SDK from v8 to v9 to match Containerfile pre-installed plugin (v9.11.0); bump pulumi-tls to v5.5.0 - Add systemd drop-in + logrotate for /var/log/gitlab-runner/runner.log - IBM Power: use dnf for otelcol-contrib install; set route via VPC gateway; deploy optional VPC bastion with floating IP for SSH access - IBM Z: wrap cloud-config in MIME multipart with base64 encoding so cloud-init decodes the payload before processing - Update all module dependencies Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent ce74314 commit ac195f9

247 files changed

Lines changed: 29595 additions & 10784 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

cmd/mapt/cmd/aws/hosts/fedora.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func getFedoraCreate() *cobra.Command {
5757
DebugLevel: viper.GetUint(params.DebugLevel),
5858
CirrusPWArgs: params.CirrusPersistentWorkerArgs(),
5959
GHRunnerArgs: params.GithubRunnerArgs(),
60-
GLRunnerArgs: params.GitLabRunnerArgs(),
60+
GLRunnerArgs: params.GitLabRunnerArgs(params.LinuxGitLabArch()),
6161
Tags: viper.GetStringMapString(params.Tags),
6262
},
6363
&fedora.FedoraArgs{

cmd/mapt/cmd/aws/hosts/mac.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func getMacRequest() *cobra.Command {
4848
Debug: viper.IsSet(params.Debug),
4949
DebugLevel: viper.GetUint(params.DebugLevel),
5050
GHRunnerArgs: params.GithubRunnerArgs(),
51-
GLRunnerArgs: params.GitLabRunnerArgs(),
51+
GLRunnerArgs: params.GitLabRunnerArgs(params.LinuxGitLabArch()),
5252
Tags: viper.GetStringMapString(params.Tags),
5353
},
5454
&mac.MacRequestArgs{

cmd/mapt/cmd/aws/hosts/rhel.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func getRHELCreate() *cobra.Command {
5353
DebugLevel: viper.GetUint(params.DebugLevel),
5454
CirrusPWArgs: params.CirrusPersistentWorkerArgs(),
5555
GHRunnerArgs: params.GithubRunnerArgs(),
56-
GLRunnerArgs: params.GitLabRunnerArgs(),
56+
GLRunnerArgs: params.GitLabRunnerArgs(params.LinuxGitLabArch()),
5757
Tags: viper.GetStringMapString(params.Tags),
5858
},
5959
&rhel.RHELArgs{

cmd/mapt/cmd/aws/hosts/windows.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func getWindowsCreate() *cobra.Command {
6666
DebugLevel: viper.GetUint(params.DebugLevel),
6767
CirrusPWArgs: params.CirrusPersistentWorkerArgs(),
6868
GHRunnerArgs: params.GithubRunnerArgs(),
69-
GLRunnerArgs: params.GitLabRunnerArgs(),
69+
GLRunnerArgs: params.GitLabRunnerArgs(params.LinuxGitLabArch()),
7070
Tags: viper.GetStringMapString(params.Tags),
7171
},
7272
&windows.WindowsServerArgs{

cmd/mapt/cmd/aws/services/mac-pool.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ func request() *cobra.Command {
174174
DebugLevel: viper.GetUint(params.DebugLevel),
175175
CirrusPWArgs: params.CirrusPersistentWorkerArgs(),
176176
GHRunnerArgs: params.GithubRunnerArgs(),
177-
GLRunnerArgs: params.GitLabRunnerArgs(),
177+
GLRunnerArgs: params.GitLabRunnerArgs(params.LinuxGitLabArch()),
178178
Tags: viper.GetStringMapString(params.Tags),
179179
},
180180
&macpool.RequestMachineArgs{

cmd/mapt/cmd/azure/hosts/rhel.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func getCreateRHEL() *cobra.Command {
4949
DebugLevel: viper.GetUint(params.DebugLevel),
5050
CirrusPWArgs: params.CirrusPersistentWorkerArgs(),
5151
GHRunnerArgs: params.GithubRunnerArgs(),
52-
GLRunnerArgs: params.GitLabRunnerArgs(),
52+
GLRunnerArgs: params.GitLabRunnerArgs(params.LinuxGitLabArch()),
5353
Tags: viper.GetStringMapString(params.Tags),
5454
},
5555
&azureRHEL.RhelArgs{

cmd/mapt/cmd/azure/hosts/windows.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ func getCreateWindowsDesktop() *cobra.Command {
6262
DebugLevel: viper.GetUint(params.DebugLevel),
6363
CirrusPWArgs: params.CirrusPersistentWorkerArgs(),
6464
GHRunnerArgs: params.GithubRunnerArgs(),
65-
GLRunnerArgs: params.GitLabRunnerArgs(),
65+
GLRunnerArgs: params.GitLabRunnerArgs(params.LinuxGitLabArch()),
6666
Tags: viper.GetStringMapString(params.Tags),
6767
},
6868
&azureWindows.WindowsArgs{

cmd/mapt/cmd/ibmcloud/hosts/ibm-power.go

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package hosts
22

33
import (
44
"github.com/redhat-developer/mapt/cmd/mapt/cmd/params"
5+
"github.com/redhat-developer/mapt/pkg/integrations/gitlab"
56
maptContext "github.com/redhat-developer/mapt/pkg/manager/context"
67
ibmpower "github.com/redhat-developer/mapt/pkg/provider/ibmcloud/action/ibm-power"
78
"github.com/spf13/cobra"
@@ -52,17 +53,24 @@ func ibmPowerCreate() *cobra.Command {
5253
DebugLevel: viper.GetUint(params.DebugLevel),
5354
CirrusPWArgs: params.CirrusPersistentWorkerArgs(),
5455
GHRunnerArgs: params.GithubRunnerArgs(),
56+
GLRunnerArgs: params.GitLabRunnerArgs(&gitlab.Ppc64le),
5557
Tags: viper.GetStringMapString(params.Tags),
5658
},
5759
&ibmpower.PWArgs{
5860
PIPrivateSubnetID: viper.GetString(params.PIPrivateSubnetID),
5961
WorkspaceID: viper.GetString(params.WorkspaceID),
6062
VPCPublicSubnetID: viper.GetString(params.VPCPublicSubnetID),
63+
Memory: viper.GetFloat64(params.PIMemory),
64+
Processors: viper.GetFloat64(params.PIProcessors),
65+
ProcType: viper.GetString(params.PIProcType),
66+
SysType: viper.GetString(params.PISysType),
67+
StorageType: viper.GetString(params.PIStorageType),
68+
DiskSize: viper.GetInt(params.PIDiskSize),
6169
OtelAppCode: viper.GetString(params.OtelAppCode),
6270
OtelAuthToken: viper.GetString(params.OtelAuthToken),
6371
OtelEndpoint: viper.GetString(params.OtelEndpoint),
64-
OtelIndex: viper.GetString(params.OtelIndex),
65-
OtelExtraAttrs: viper.GetStringMapString(params.OtelExtraAttrs),
72+
OtelIndex: viper.GetString(params.OtelIndex),
73+
OtelExtraAttrs: viper.GetStringMapString(params.OtelExtraAttrs),
6674
})
6775
},
6876
}
@@ -77,8 +85,16 @@ func ibmPowerCreate() *cobra.Command {
7785
flagSet.StringP(params.OtelEndpoint, "", "https://otel-input.corp.redhat.com", params.OtelEndpointDesc)
7886
flagSet.StringP(params.OtelIndex, "", "", params.OtelIndexDesc)
7987
flagSet.StringToStringP(params.OtelExtraAttrs, "", nil, params.OtelExtraAttrsDesc)
88+
flagSet.Float64(params.PIMemory, params.PIMemoryDefault, params.PIMemoryDesc)
89+
flagSet.Float64(params.PIProcessors, params.PIProcessorsDefault, params.PIProcessorsDesc)
90+
flagSet.String(params.PIProcType, params.PIProcTypeDefault, params.PIProcTypeDesc)
91+
flagSet.String(params.PISysType, params.PISysTypeDefault, params.PISysTypeDesc)
92+
flagSet.String(params.PIStorageType, params.PIStorageTypeDefault, params.PIStorageTypeDesc)
93+
flagSet.Int(params.PIDiskSize, params.PIDiskSizeDefault, params.PIDiskSizeDesc)
8094
params.AddGHActionsFlags(flagSet)
8195
params.AddCirrusFlags(flagSet)
96+
params.AddGitLabRunnerFlags(flagSet)
97+
flagSet.Int(params.GlRunnerConcurrent, params.GlRunnerConcurrentPowerDefault, params.GlRunnerConcurrentDesc)
8298
c.PersistentFlags().AddFlagSet(flagSet)
8399
_ = c.MarkPersistentFlagRequired(params.PIPrivateSubnetID)
84100
_ = c.MarkPersistentFlagRequired(params.WorkspaceID)

cmd/mapt/cmd/ibmcloud/hosts/ibm-z.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package hosts
22

33
import (
44
"github.com/redhat-developer/mapt/cmd/mapt/cmd/params"
5+
"github.com/redhat-developer/mapt/pkg/integrations/gitlab"
56
maptContext "github.com/redhat-developer/mapt/pkg/manager/context"
67
ibmz "github.com/redhat-developer/mapt/pkg/provider/ibmcloud/action/ibm-z"
78
"github.com/spf13/cobra"
@@ -52,14 +53,17 @@ func ibmZCreate() *cobra.Command {
5253
DebugLevel: viper.GetUint(params.DebugLevel),
5354
CirrusPWArgs: params.CirrusPersistentWorkerArgs(),
5455
GHRunnerArgs: params.GithubRunnerArgs(),
56+
GLRunnerArgs: params.GitLabRunnerArgs(&gitlab.S390x),
5557
Tags: viper.GetStringMapString(params.Tags),
5658
},
5759
&ibmz.ZArgs{
5860
SubnetID: viper.GetString(params.SubnetID),
61+
Profile: viper.GetString(params.IZProfile),
62+
DiskSize: viper.GetInt(params.IZDiskSize),
5963
OtelAppCode: viper.GetString(params.OtelAppCode),
6064
OtelAuthToken: viper.GetString(params.OtelAuthToken),
6165
OtelEndpoint: viper.GetString(params.OtelEndpoint),
62-
OtelIndex: viper.GetString(params.OtelIndex),
66+
OtelIndex: viper.GetString(params.OtelIndex),
6367
OtelExtraAttrs: viper.GetStringMapString(params.OtelExtraAttrs),
6468
})
6569
},
@@ -73,8 +77,12 @@ func ibmZCreate() *cobra.Command {
7377
flagSet.StringP(params.OtelEndpoint, "", "https://otel-input.corp.redhat.com", params.OtelEndpointDesc)
7478
flagSet.StringP(params.OtelIndex, "", "", params.OtelIndexDesc)
7579
flagSet.StringToStringP(params.OtelExtraAttrs, "", nil, params.OtelExtraAttrsDesc)
80+
flagSet.String(params.IZProfile, params.IZProfileDefault, params.IZProfileDesc)
81+
flagSet.Int(params.IZDiskSize, params.IZDiskSizeDefault, params.IZDiskSizeDesc)
7682
params.AddGHActionsFlags(flagSet)
7783
params.AddCirrusFlags(flagSet)
84+
params.AddGitLabRunnerFlags(flagSet)
85+
flagSet.Int(params.GlRunnerConcurrent, params.GlRunnerConcurrentS390xDefault, params.GlRunnerConcurrentDesc)
7886
c.PersistentFlags().AddFlagSet(flagSet)
7987
return c
8088
}

cmd/mapt/cmd/params/params.go

Lines changed: 58 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
cr "github.com/redhat-developer/mapt/pkg/provider/api/compute-request"
88
spotTypes "github.com/redhat-developer/mapt/pkg/provider/api/spot"
99
"github.com/redhat-developer/mapt/pkg/util"
10+
"github.com/redhat-developer/mapt/pkg/util/logging"
1011
"github.com/spf13/pflag"
1112
"github.com/spf13/viper"
1213
)
@@ -82,7 +83,7 @@ const (
8283
cirrusPWLabelsDesc string = "additional labels to use on the persistent worker (--it-cirrus-pw-labels key1=value1,key2=value2)"
8384

8485
glRunnerToken string = "glrunner-token"
85-
glRunnerTokenDesc string = "GitLab Personal Access Token with api scope"
86+
glRunnerTokenDesc string = "GitLab token with create_runner scope (personal access token, group/project access token, or service account token)"
8687
glRunnerProjectID string = "glrunner-project-id"
8788
glRunnerProjectIDDesc string = "GitLab project ID for project runner registration"
8889
glRunnerGroupID string = "glrunner-group-id"
@@ -92,6 +93,13 @@ const (
9293
glRunnerURLDefault string = "https://gitlab.com"
9394
glRunnerTags string = "glrunner-tags"
9495
glRunnerTagsDesc string = "List of tags separated by comma to be added to the self-hosted runner"
96+
glRunnerUnsecure string = "glrunner-unsecure"
97+
glRunnerUnsecureDesc string = "when set, the runner service runs as the default OS user instead of a dedicated system account; by default a locked-down gitlab-runner system user is created"
98+
99+
GlRunnerConcurrent string = "glrunner-concurrent"
100+
GlRunnerConcurrentDesc string = "maximum number of jobs the runner executes concurrently"
101+
GlRunnerConcurrentPowerDefault int = 2
102+
GlRunnerConcurrentS390xDefault int = 3
95103

96104
//RHEL
97105
SubsUsername string = "rh-subscription-username"
@@ -134,6 +142,34 @@ const (
134142
VPCPublicSubnetID string = "vpc-public-subnet-id"
135143
VPCPublicSubnetIDDesc string = "ID of an existing VPC subnet (with public gateway, connected to Transit Gateway) for the SSH bastion"
136144

145+
// IBM Power instance sizing
146+
PIMemory string = "pi-memory"
147+
PIMemoryDesc string = "PowerVS instance memory in GB"
148+
PIMemoryDefault float64 = 96.0
149+
PIProcessors string = "pi-processors"
150+
PIProcessorsDesc string = "PowerVS instance processor count (shared cores)"
151+
PIProcessorsDefault float64 = 24.0
152+
PIProcType string = "pi-proc-type"
153+
PIProcTypeDesc string = "PowerVS processor type (shared, dedicated, capped)"
154+
PIProcTypeDefault string = "shared"
155+
PISysType string = "pi-sys-type"
156+
PISysTypeDesc string = "PowerVS system type (s922, s1022, e880, e980)"
157+
PISysTypeDefault string = "s1022"
158+
PIStorageType string = "pi-storage-type"
159+
PIStorageTypeDesc string = "PowerVS storage tier for instance and data volume (tier1, tier3)"
160+
PIStorageTypeDefault string = "tier1"
161+
PIDiskSize string = "pi-disk-size"
162+
PIDiskSizeDesc string = "data volume size in GB attached to the PowerVS instance"
163+
PIDiskSizeDefault int = 300
164+
165+
// IBM Z instance sizing
166+
IZProfile string = "iz-profile"
167+
IZProfileDesc string = "IBM Z VPC instance profile name"
168+
IZProfileDefault string = "mz2-16x128"
169+
IZDiskSize string = "iz-disk-size"
170+
IZDiskSizeDesc string = "boot volume size in GB for the IBM Z instance"
171+
IZDiskSizeDefault int = 300
172+
137173
OtelAppCode string = "otel-app-code"
138174
OtelAppCodeDesc string = "OpenTelemetry appcode identifier (e.g. MAPT-001); when set together with --otel-auth-token, installs the otelcol-contrib filelog collector on the instance"
139175
OtelAuthToken string = "otel-auth-token"
@@ -269,8 +305,10 @@ func AddGitLabRunnerFlags(fs *pflag.FlagSet) {
269305
fs.StringP(glRunnerGroupID, "", "", glRunnerGroupIDDesc)
270306
fs.StringP(glRunnerURL, "", glRunnerURLDefault, glRunnerURLDesc)
271307
fs.StringSlice(glRunnerTags, nil, glRunnerTagsDesc)
308+
fs.Bool(glRunnerUnsecure, false, glRunnerUnsecureDesc)
272309
}
273310

311+
274312
func CirrusPersistentWorkerArgs() *cirrus.PersistentWorkerArgs {
275313
if viper.IsSet(cirrusPWToken) {
276314
return &cirrus.PersistentWorkerArgs{
@@ -284,21 +322,31 @@ func CirrusPersistentWorkerArgs() *cirrus.PersistentWorkerArgs {
284322
return nil
285323
}
286324

287-
func GitLabRunnerArgs() *gitlab.GitLabRunnerArgs {
325+
func GitLabRunnerArgs(arch *gitlab.Arch) *gitlab.GitLabRunnerArgs {
288326
if viper.IsSet(glRunnerToken) {
327+
if viper.IsSet(glRunnerProjectID) && viper.IsSet(glRunnerGroupID) {
328+
logging.Error("--glrunner-project-id and --glrunner-group-id are mutually exclusive; ignoring GitLab runner configuration")
329+
return nil
330+
}
289331
return &gitlab.GitLabRunnerArgs{
290-
GitLabPAT: viper.GetString(glRunnerToken),
291-
ProjectID: viper.GetString(glRunnerProjectID),
292-
GroupID: viper.GetString(glRunnerGroupID),
293-
URL: viper.GetString(glRunnerURL),
294-
Tags: viper.GetStringSlice(glRunnerTags),
295-
Platform: &gitlab.Linux,
296-
Arch: linuxArchAsGitLabArch(viper.GetString(LinuxArch)),
332+
GitLabToken: viper.GetString(glRunnerToken),
333+
ProjectID: viper.GetString(glRunnerProjectID),
334+
GroupID: viper.GetString(glRunnerGroupID),
335+
URL: viper.GetString(glRunnerURL),
336+
Tags: viper.GetStringSlice(glRunnerTags),
337+
Platform: &gitlab.Linux,
338+
Arch: arch,
339+
Unsecure: viper.GetBool(glRunnerUnsecure),
340+
Concurrent: viper.GetInt(GlRunnerConcurrent),
297341
}
298342
}
299343
return nil
300344
}
301345

346+
func LinuxGitLabArch() *gitlab.Arch {
347+
return linuxArchAsGitLabArch(viper.GetString(LinuxArch))
348+
}
349+
302350
func linuxArchAsCirrusArch(arch string) *cirrus.Arch {
303351
switch arch {
304352
case "x86_64":
@@ -338,3 +386,4 @@ func MACArchAsGitLabArch(arch string) *gitlab.Arch {
338386
}
339387
return &gitlab.Arm64
340388
}
389+

0 commit comments

Comments
 (0)