Skip to content

Commit 2ef8d55

Browse files
committed
feat(gitlab): migrate to Pulumi authentication token workflow
Migrate GitLab Runner integration from registration token workflow to authentication token workflow using Pulumi's GitLab provider. This aligns with GitLab 16.0+ recommended practices and enables programmatic runner creation. Changes: - --glrunner-token now expects GitLab PAT (api/create_runner scope) - New flags: --glrunner-project-id and --glrunner-group-id - Removed flags: --glrunner-executor, --glrunner-tags, --glrunner-scope Features: - Support for both project runners and group runners - Automatic runner creation via Pulumi during stack deployment - Runner configuration managed as code (tags, executor, access level) - Auto-detection of runner type based on ID provided Implementation: - Created pkg/integrations/gitlab/pulumi.go for Pulumi GitLab provider - Updated GitLabRunnerArgs with GitLabPAT, ProjectID, GroupID, AuthToken - Added SetAuthToken() for dynamic token injection during deployment - Implemented UserdataWithGitLabToken() for async token handling - Updated AWS Fedora provider to create runner before userdata generation - Modified CLI params to support new flag structure Usage: ./mapt aws fedora create \ --glrunner-token <gitlab-pat> \ --glrunner-group-id 12345 \ --glrunner-url https://gitlab.com Signed-off-by: Jose Angel Morena <[email protected]>
1 parent efd14e3 commit 2ef8d55

File tree

42 files changed

+530
-88
lines changed

Some content is hidden

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

42 files changed

+530
-88
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ func getFedoraCreate() *cobra.Command {
5656
DebugLevel: viper.GetUint(params.DebugLevel),
5757
CirrusPWArgs: params.CirrusPersistentWorkerArgs(),
5858
GHRunnerArgs: params.GithubRunnerArgs(),
59+
GLRunnerArgs: params.GitLabRunnerArgs(),
5960
Tags: viper.GetStringMapString(params.Tags),
6061
},
6162
&fedora.FedoraArgs{
@@ -79,6 +80,7 @@ func getFedoraCreate() *cobra.Command {
7980
params.AddSpotFlags(flagSet)
8081
params.AddGHActionsFlags(flagSet)
8182
params.AddCirrusFlags(flagSet)
83+
params.AddGitLabRunnerFlags(flagSet)
8284
c.PersistentFlags().AddFlagSet(flagSet)
8385
return c
8486
}
@@ -92,7 +94,7 @@ func getFedoraDestroy() *cobra.Command {
9294
return err
9395
}
9496
return fedora.Destroy(&maptContext.ContextArgs{
95-
Context: cmd.Context(),
97+
Context: cmd.Context(),
9698
ProjectName: viper.GetString(params.ProjectName),
9799
BackedURL: viper.GetString(params.BackedURL),
98100
Debug: viper.IsSet(params.Debug),

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +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(),
5152
Tags: viper.GetStringMapString(params.Tags),
5253
},
5354
&mac.MacRequestArgs{
@@ -67,6 +68,7 @@ func getMacRequest() *cobra.Command {
6768
flagSet.Bool(awsParams.MACFixedLocation, false, awsParams.MACFixedLocationDesc)
6869
flagSet.Bool(airgap, false, airgapDesc)
6970
params.AddGHActionsFlags(flagSet)
71+
params.AddGitLabRunnerFlags(flagSet)
7072
c.PersistentFlags().AddFlagSet(flagSet)
7173
return c
7274
}
@@ -82,7 +84,7 @@ func getMacRelease() *cobra.Command {
8284
}
8385
return mac.Release(
8486
&maptContext.ContextArgs{
85-
Context: cmd.Context(),
87+
Context: cmd.Context(),
8688
Debug: viper.IsSet(params.Debug),
8789
DebugLevel: viper.GetUint(params.DebugLevel),
8890
},
@@ -109,10 +111,10 @@ func getMacDestroy() *cobra.Command {
109111
}
110112
return mac.Destroy(
111113
&maptContext.ContextArgs{
112-
Context: cmd.Context(),
113-
Debug: viper.IsSet(params.Debug),
114-
DebugLevel: viper.GetUint(params.DebugLevel),
115-
KeepState: viper.IsSet(params.KeepState),
114+
Context: cmd.Context(),
115+
Debug: viper.IsSet(params.Debug),
116+
DebugLevel: viper.GetUint(params.DebugLevel),
117+
KeepState: viper.IsSet(params.KeepState),
116118
},
117119
viper.GetString(awsParams.MACDHID))
118120
},

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ func getRHELCreate() *cobra.Command {
5252
DebugLevel: viper.GetUint(params.DebugLevel),
5353
CirrusPWArgs: params.CirrusPersistentWorkerArgs(),
5454
GHRunnerArgs: params.GithubRunnerArgs(),
55+
GLRunnerArgs: params.GitLabRunnerArgs(),
5556
Tags: viper.GetStringMapString(params.Tags),
5657
},
5758
&rhel.RHELArgs{
@@ -82,6 +83,7 @@ func getRHELCreate() *cobra.Command {
8283
params.AddSpotFlags(flagSet)
8384
params.AddGHActionsFlags(flagSet)
8485
params.AddCirrusFlags(flagSet)
86+
params.AddGitLabRunnerFlags(flagSet)
8587
c.PersistentFlags().AddFlagSet(flagSet)
8688
return c
8789
}
@@ -95,13 +97,13 @@ func getRHELDestroy() *cobra.Command {
9597
return err
9698
}
9799
return rhel.Destroy(&maptContext.ContextArgs{
98-
Context: cmd.Context(),
99-
ProjectName: viper.GetString(params.ProjectName),
100-
BackedURL: viper.GetString(params.BackedURL),
101-
Debug: viper.IsSet(params.Debug),
102-
DebugLevel: viper.GetUint(params.DebugLevel),
103-
Serverless: viper.IsSet(params.Serverless),
104-
KeepState: viper.IsSet(params.KeepState),
100+
Context: cmd.Context(),
101+
ProjectName: viper.GetString(params.ProjectName),
102+
BackedURL: viper.GetString(params.BackedURL),
103+
Debug: viper.IsSet(params.Debug),
104+
DebugLevel: viper.GetUint(params.DebugLevel),
105+
Serverless: viper.IsSet(params.Serverless),
106+
KeepState: viper.IsSet(params.KeepState),
105107
})
106108
},
107109
}

cmd/mapt/cmd/aws/hosts/rhelai.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ func getRHELAIDestroy() *cobra.Command {
8787
return err
8888
}
8989
return rhelai.Destroy(&maptContext.ContextArgs{
90-
Context: cmd.Context(),
90+
Context: cmd.Context(),
9191
ProjectName: viper.GetString(params.ProjectName),
9292
BackedURL: viper.GetString(params.BackedURL),
9393
Debug: viper.IsSet(params.Debug),

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ func getWindowsCreate() *cobra.Command {
6565
DebugLevel: viper.GetUint(params.DebugLevel),
6666
CirrusPWArgs: params.CirrusPersistentWorkerArgs(),
6767
GHRunnerArgs: params.GithubRunnerArgs(),
68+
GLRunnerArgs: params.GitLabRunnerArgs(),
6869
Tags: viper.GetStringMapString(params.Tags),
6970
},
7071
&windows.WindowsServerArgs{
@@ -93,6 +94,7 @@ func getWindowsCreate() *cobra.Command {
9394
params.AddSpotFlags(flagSet)
9495
params.AddGHActionsFlags(flagSet)
9596
params.AddCirrusFlags(flagSet)
97+
params.AddGitLabRunnerFlags(flagSet)
9698
c.PersistentFlags().AddFlagSet(flagSet)
9799
return c
98100
}
@@ -106,13 +108,13 @@ func getWindowsDestroy() *cobra.Command {
106108
return err
107109
}
108110
return windows.Destroy(&maptContext.ContextArgs{
109-
Context: cmd.Context(),
110-
ProjectName: viper.GetString(params.ProjectName),
111-
BackedURL: viper.GetString(params.BackedURL),
112-
Debug: viper.IsSet(params.Debug),
113-
DebugLevel: viper.GetUint(params.DebugLevel),
114-
Serverless: viper.IsSet(params.Serverless),
115-
KeepState: viper.IsSet(params.KeepState),
111+
Context: cmd.Context(),
112+
ProjectName: viper.GetString(params.ProjectName),
113+
BackedURL: viper.GetString(params.BackedURL),
114+
Debug: viper.IsSet(params.Debug),
115+
DebugLevel: viper.GetUint(params.DebugLevel),
116+
Serverless: viper.IsSet(params.Serverless),
117+
KeepState: viper.IsSet(params.KeepState),
116118
})
117119
},
118120
}

cmd/mapt/cmd/aws/services/eks.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,12 @@ func getDestroyEKS() *cobra.Command {
108108
}
109109
return awsEKS.Destroy(
110110
&maptContext.ContextArgs{
111-
Context: cmd.Context(),
112-
ProjectName: viper.GetString(params.ProjectName),
113-
BackedURL: viper.GetString(params.BackedURL),
114-
Debug: viper.IsSet(params.Debug),
115-
DebugLevel: viper.GetUint(params.DebugLevel),
116-
KeepState: viper.IsSet(params.KeepState),
111+
Context: cmd.Context(),
112+
ProjectName: viper.GetString(params.ProjectName),
113+
BackedURL: viper.GetString(params.BackedURL),
114+
Debug: viper.IsSet(params.Debug),
115+
DebugLevel: viper.GetUint(params.DebugLevel),
116+
KeepState: viper.IsSet(params.KeepState),
117117
})
118118
},
119119
}

cmd/mapt/cmd/aws/services/kind.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ func destroyKind() *cobra.Command {
9595
return err
9696
}
9797
return kind.Destroy(&maptContext.ContextArgs{
98-
Context: cmd.Context(),
98+
Context: cmd.Context(),
9999
ProjectName: viper.GetString(params.ProjectName),
100100
BackedURL: viper.GetString(params.BackedURL),
101101
Debug: viper.IsSet(params.Debug),

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

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,12 @@ func destroyMP() *cobra.Command {
9999
return err
100100
}
101101
return macpool.Destroy(&maptContext.ContextArgs{
102-
Context: cmd.Context(),
103-
ProjectName: viper.GetString(params.ProjectName),
104-
BackedURL: viper.GetString(params.BackedURL),
105-
Debug: viper.IsSet(params.Debug),
106-
DebugLevel: viper.GetUint(params.DebugLevel),
107-
KeepState: viper.IsSet(params.KeepState),
102+
Context: cmd.Context(),
103+
ProjectName: viper.GetString(params.ProjectName),
104+
BackedURL: viper.GetString(params.BackedURL),
105+
Debug: viper.IsSet(params.Debug),
106+
DebugLevel: viper.GetUint(params.DebugLevel),
107+
KeepState: viper.IsSet(params.KeepState),
108108
})
109109
},
110110
}
@@ -125,7 +125,7 @@ func houseKeep() *cobra.Command {
125125
}
126126
return macpool.HouseKeeper(
127127
&maptContext.ContextArgs{
128-
Context: cmd.Context(),
128+
Context: cmd.Context(),
129129
ProjectName: viper.GetString(params.ProjectName),
130130
BackedURL: viper.GetString(params.BackedURL),
131131
Serverless: viper.IsSet(params.Serverless),
@@ -172,6 +172,7 @@ func request() *cobra.Command {
172172
DebugLevel: viper.GetUint(params.DebugLevel),
173173
CirrusPWArgs: params.CirrusPersistentWorkerArgs(),
174174
GHRunnerArgs: params.GithubRunnerArgs(),
175+
GLRunnerArgs: params.GitLabRunnerArgs(),
175176
Tags: viper.GetStringMapString(params.Tags),
176177
},
177178
&macpool.RequestMachineArgs{
@@ -191,6 +192,7 @@ func request() *cobra.Command {
191192
flagSet.StringP(params.Timeout, "", "", params.TimeoutDesc)
192193
params.AddGHActionsFlags(flagSet)
193194
params.AddCirrusFlags(flagSet)
195+
params.AddGitLabRunnerFlags(flagSet)
194196
c.PersistentFlags().AddFlagSet(flagSet)
195197
return c
196198
}
@@ -205,7 +207,7 @@ func release() *cobra.Command {
205207
}
206208
return macpool.Release(
207209
&maptContext.ContextArgs{
208-
Context: cmd.Context(),
210+
Context: cmd.Context(),
209211
Debug: viper.IsSet(params.Debug),
210212
DebugLevel: viper.GetUint(params.DebugLevel),
211213
Serverless: viper.IsSet(params.Serverless),

cmd/mapt/cmd/aws/services/openshift-snc.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,13 @@ func destroySNC() *cobra.Command {
9090
return err
9191
}
9292
return openshiftsnc.Destroy(&maptContext.ContextArgs{
93-
Context: cmd.Context(),
94-
ProjectName: viper.GetString(params.ProjectName),
95-
BackedURL: viper.GetString(params.BackedURL),
96-
Debug: viper.IsSet(params.Debug),
97-
DebugLevel: viper.GetUint(params.DebugLevel),
98-
Serverless: viper.IsSet(params.Serverless),
99-
KeepState: viper.IsSet(params.KeepState),
93+
Context: cmd.Context(),
94+
ProjectName: viper.GetString(params.ProjectName),
95+
BackedURL: viper.GetString(params.BackedURL),
96+
Debug: viper.IsSet(params.Debug),
97+
DebugLevel: viper.GetUint(params.DebugLevel),
98+
Serverless: viper.IsSet(params.Serverless),
99+
KeepState: viper.IsSet(params.KeepState),
100100
})
101101
},
102102
}

cmd/mapt/cmd/azure/hosts/linux.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ func getDestroyLinux() *cobra.Command {
9292
return err
9393
}
9494
return azureLinux.Destroy(&maptContext.ContextArgs{
95-
Context: cmd.Context(),
95+
Context: cmd.Context(),
9696
ProjectName: viper.GetString(params.ProjectName),
9797
BackedURL: viper.GetString(params.BackedURL),
9898
Debug: viper.IsSet(params.Debug),

0 commit comments

Comments
 (0)