Skip to content

Commit d465c2b

Browse files
adrianrioboclaude
andcommitted
feat(ibmcloud): add GitLab runner support for IBM Power (ppc64le) and IBM Z (s390x)
Extends the IBM Power (ppc64le/RHEL9) and IBM Z (s390x/Ubuntu 22.04) provisioning to register and configure a GitLab runner on each target. Architecture: - GitLab 15.10+ new creation workflow: NewUserRunner API returns an auth token which is then used with `gitlab-runner register --token` (no deprecated registration tokens) - Runner creation happens inside the Pulumi deploy() function via gitlab.CreateRunner(); the auth token is a pulumi.StringOutput resolved with ApplyT before cloud-init is rendered - No global state: the runner args struct is copied before the ApplyT closure and AuthToken is set on the local copy New arch support in pkg/integrations/gitlab: - Added Ppc64le and S390x Arch values - Renamed GitLabPAT → GitLabToken (accepts PAT, group/project access token, or service account token with create_runner scope) - Made restorecon graceful on non-SELinux systems (Ubuntu/IBM Z) CLI changes: - params.GitLabRunnerArgs now takes *gitlab.Arch so fixed-arch targets (IBM) pass their arch directly; variable-arch targets use params.LinuxGitLabArch() - Mutual exclusion check for --glrunner-project-id and --glrunner-group-id - GitLab runner flags added to ibm-power and ibm-z create commands Cloud-init (both IBM targets): - Systemd drop-in redirects gitlab-runner stdout/stderr to /var/log/gitlab-runner/runner.log - Logrotate config for runner.log (daily, 7 rotations, copytruncate) - otelcol-contrib filelog/gitlab-runner receiver ships job logs to the OTLP endpoint when both otel and runner are configured (start_at: end) - IBM Z cloud-config runs apt-get update before apt-get install Error handling: - buildUserDataInput() in ibm-z returns (pulumi.StringPtrInput, error) instead of silently dropping template errors Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 82e1b2d commit d465c2b

19 files changed

Lines changed: 467 additions & 85 deletions

File tree

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: 3 additions & 0 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,6 +53,7 @@ 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{
@@ -79,6 +81,7 @@ func ibmPowerCreate() *cobra.Command {
7981
flagSet.StringToStringP(params.OtelExtraAttrs, "", nil, params.OtelExtraAttrsDesc)
8082
params.AddGHActionsFlags(flagSet)
8183
params.AddCirrusFlags(flagSet)
84+
params.AddGitLabRunnerFlags(flagSet)
8285
c.PersistentFlags().AddFlagSet(flagSet)
8386
_ = c.MarkPersistentFlagRequired(params.PIPrivateSubnetID)
8487
_ = c.MarkPersistentFlagRequired(params.WorkspaceID)

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

Lines changed: 3 additions & 0 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
ibmz "github.com/redhat-developer/mapt/pkg/provider/ibmcloud/action/ibm-z"
78
"github.com/spf13/cobra"
@@ -52,6 +53,7 @@ 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{
@@ -75,6 +77,7 @@ func ibmZCreate() *cobra.Command {
7577
flagSet.StringToStringP(params.OtelExtraAttrs, "", nil, params.OtelExtraAttrsDesc)
7678
params.AddGHActionsFlags(flagSet)
7779
params.AddCirrusFlags(flagSet)
80+
params.AddGitLabRunnerFlags(flagSet)
7881
c.PersistentFlags().AddFlagSet(flagSet)
7982
return c
8083
}

cmd/mapt/cmd/params/params.go

Lines changed: 20 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"
@@ -271,6 +272,7 @@ func AddGitLabRunnerFlags(fs *pflag.FlagSet) {
271272
fs.StringSlice(glRunnerTags, nil, glRunnerTagsDesc)
272273
}
273274

275+
274276
func CirrusPersistentWorkerArgs() *cirrus.PersistentWorkerArgs {
275277
if viper.IsSet(cirrusPWToken) {
276278
return &cirrus.PersistentWorkerArgs{
@@ -284,21 +286,29 @@ func CirrusPersistentWorkerArgs() *cirrus.PersistentWorkerArgs {
284286
return nil
285287
}
286288

287-
func GitLabRunnerArgs() *gitlab.GitLabRunnerArgs {
289+
func GitLabRunnerArgs(arch *gitlab.Arch) *gitlab.GitLabRunnerArgs {
288290
if viper.IsSet(glRunnerToken) {
291+
if viper.IsSet(glRunnerProjectID) && viper.IsSet(glRunnerGroupID) {
292+
logging.Error("--glrunner-project-id and --glrunner-group-id are mutually exclusive; ignoring GitLab runner configuration")
293+
return nil
294+
}
289295
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)),
296+
GitLabToken: viper.GetString(glRunnerToken),
297+
ProjectID: viper.GetString(glRunnerProjectID),
298+
GroupID: viper.GetString(glRunnerGroupID),
299+
URL: viper.GetString(glRunnerURL),
300+
Tags: viper.GetStringSlice(glRunnerTags),
301+
Platform: &gitlab.Linux,
302+
Arch: arch,
297303
}
298304
}
299305
return nil
300306
}
301307

308+
func LinuxGitLabArch() *gitlab.Arch {
309+
return linuxArchAsGitLabArch(viper.GetString(LinuxArch))
310+
}
311+
302312
func linuxArchAsCirrusArch(arch string) *cirrus.Arch {
303313
switch arch {
304314
case "x86_64":
@@ -338,3 +348,4 @@ func MACArchAsGitLabArch(arch string) *gitlab.Arch {
338348
}
339349
return &gitlab.Arm64
340350
}
351+

0 commit comments

Comments
 (0)