diff --git a/README.md b/README.md index ca2bdc753..6f0b27a4e 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,6 @@ In addition we can provision The integrations allow to provision the machine and link to different CI/CD systems based on their native integrations. * [Github Self Hosted Runner](https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners/about-self-hosted-runners) -* [Cirrus Persistent Worker](https://cirrus-ci.org/guide/persistent-workers/) * [GitLab Runner](docs/gitlab-runner.md) And [Tekton tasks](tkn) are offered to dynamically provision the remote target to use within tekton pipelines \ No newline at end of file diff --git a/cmd/mapt/cmd/aws/hosts/fedora.go b/cmd/mapt/cmd/aws/hosts/fedora.go index 92bc1fb5e..ee2bcf482 100644 --- a/cmd/mapt/cmd/aws/hosts/fedora.go +++ b/cmd/mapt/cmd/aws/hosts/fedora.go @@ -55,7 +55,6 @@ func getFedoraCreate() *cobra.Command { ResultsOutput: viper.GetString(params.ConnectionDetailsOutput), Debug: viper.IsSet(params.Debug), DebugLevel: viper.GetUint(params.DebugLevel), - CirrusPWArgs: params.CirrusPersistentWorkerArgs(), GHRunnerArgs: params.GithubRunnerArgs(params.LinuxGithubArch()), GLRunnerArgs: params.GitLabRunnerArgs(params.LinuxGitLabArch()), Tags: viper.GetStringMapString(params.Tags), @@ -82,7 +81,6 @@ func getFedoraCreate() *cobra.Command { params.AddSpotFlags(flagSet) params.AddNetworkFlags(flagSet, awsParams.ServiceEndpointsDesc) params.AddGHActionsFlags(flagSet) - params.AddCirrusFlags(flagSet) params.AddGitLabRunnerFlags(flagSet) c.PersistentFlags().AddFlagSet(flagSet) return c diff --git a/cmd/mapt/cmd/aws/hosts/rhel.go b/cmd/mapt/cmd/aws/hosts/rhel.go index 9c4062e84..eb15a60c4 100644 --- a/cmd/mapt/cmd/aws/hosts/rhel.go +++ b/cmd/mapt/cmd/aws/hosts/rhel.go @@ -51,7 +51,6 @@ func getRHELCreate() *cobra.Command { ResultsOutput: viper.GetString(params.ConnectionDetailsOutput), Debug: viper.IsSet(params.Debug), DebugLevel: viper.GetUint(params.DebugLevel), - CirrusPWArgs: params.CirrusPersistentWorkerArgs(), GHRunnerArgs: params.GithubRunnerArgs(params.LinuxGithubArch()), GLRunnerArgs: params.GitLabRunnerArgs(params.LinuxGitLabArch()), Tags: viper.GetStringMapString(params.Tags), @@ -85,7 +84,6 @@ func getRHELCreate() *cobra.Command { params.AddSpotFlags(flagSet) params.AddNetworkFlags(flagSet, awsParams.ServiceEndpointsDesc) params.AddGHActionsFlags(flagSet) - params.AddCirrusFlags(flagSet) params.AddGitLabRunnerFlags(flagSet) c.PersistentFlags().AddFlagSet(flagSet) return c diff --git a/cmd/mapt/cmd/aws/hosts/windows.go b/cmd/mapt/cmd/aws/hosts/windows.go index c714372ba..2c17a1466 100644 --- a/cmd/mapt/cmd/aws/hosts/windows.go +++ b/cmd/mapt/cmd/aws/hosts/windows.go @@ -64,7 +64,6 @@ func getWindowsCreate() *cobra.Command { ResultsOutput: viper.GetString(params.ConnectionDetailsOutput), Debug: viper.IsSet(params.Debug), DebugLevel: viper.GetUint(params.DebugLevel), - CirrusPWArgs: params.CirrusPersistentWorkerArgs(), GHRunnerArgs: params.GithubRunnerArgs(params.LinuxGithubArch()), GLRunnerArgs: params.GitLabRunnerArgs(params.LinuxGitLabArch()), Tags: viper.GetStringMapString(params.Tags), @@ -97,7 +96,6 @@ func getWindowsCreate() *cobra.Command { params.AddComputeRequestFlags(flagSet) params.AddSpotFlags(flagSet) params.AddGHActionsFlags(flagSet) - params.AddCirrusFlags(flagSet) params.AddGitLabRunnerFlags(flagSet) params.AddNetworkFlags(flagSet, awsParams.ServiceEndpointsDesc) c.PersistentFlags().AddFlagSet(flagSet) diff --git a/cmd/mapt/cmd/aws/services/mac-pool.go b/cmd/mapt/cmd/aws/services/mac-pool.go index 6e39d796b..f10629a7e 100644 --- a/cmd/mapt/cmd/aws/services/mac-pool.go +++ b/cmd/mapt/cmd/aws/services/mac-pool.go @@ -172,7 +172,6 @@ func request() *cobra.Command { ResultsOutput: viper.GetString(params.ConnectionDetailsOutput), Debug: viper.IsSet(params.Debug), DebugLevel: viper.GetUint(params.DebugLevel), - CirrusPWArgs: params.CirrusPersistentWorkerArgs(), GHRunnerArgs: params.GithubRunnerArgs(params.LinuxGithubArch()), GLRunnerArgs: params.GitLabRunnerArgs(params.LinuxGitLabArch()), Tags: viper.GetStringMapString(params.Tags), @@ -193,7 +192,6 @@ func request() *cobra.Command { flagSet.StringP(awsParams.MACOSVersion, "", awsParams.MACOSVersion, awsParams.MACOSVersionDefault) flagSet.StringP(params.Timeout, "", "", params.TimeoutDesc) params.AddGHActionsFlags(flagSet) - params.AddCirrusFlags(flagSet) params.AddGitLabRunnerFlags(flagSet) c.PersistentFlags().AddFlagSet(flagSet) return c diff --git a/cmd/mapt/cmd/azure/hosts/rhel.go b/cmd/mapt/cmd/azure/hosts/rhel.go index e4d3750af..0f5ee71e4 100644 --- a/cmd/mapt/cmd/azure/hosts/rhel.go +++ b/cmd/mapt/cmd/azure/hosts/rhel.go @@ -47,7 +47,6 @@ func getCreateRHEL() *cobra.Command { ResultsOutput: viper.GetString(params.ConnectionDetailsOutput), Debug: viper.IsSet(params.Debug), DebugLevel: viper.GetUint(params.DebugLevel), - CirrusPWArgs: params.CirrusPersistentWorkerArgs(), GHRunnerArgs: params.GithubRunnerArgs(params.LinuxGithubArch()), GLRunnerArgs: params.GitLabRunnerArgs(params.LinuxGitLabArch()), Tags: viper.GetStringMapString(params.Tags), @@ -77,7 +76,6 @@ func getCreateRHEL() *cobra.Command { params.AddComputeRequestFlags(flagSet) params.AddSpotFlags(flagSet) params.AddGHActionsFlags(flagSet) - params.AddCirrusFlags(flagSet) params.AddGitLabRunnerFlags(flagSet) c.PersistentFlags().AddFlagSet(flagSet) return c diff --git a/cmd/mapt/cmd/azure/hosts/windows.go b/cmd/mapt/cmd/azure/hosts/windows.go index 6356ebc77..6d1549d8d 100644 --- a/cmd/mapt/cmd/azure/hosts/windows.go +++ b/cmd/mapt/cmd/azure/hosts/windows.go @@ -60,7 +60,6 @@ func getCreateWindowsDesktop() *cobra.Command { ResultsOutput: viper.GetString(params.ConnectionDetailsOutput), Debug: viper.IsSet(params.Debug), DebugLevel: viper.GetUint(params.DebugLevel), - CirrusPWArgs: params.CirrusPersistentWorkerArgs(), GHRunnerArgs: params.GithubRunnerArgs(params.LinuxGithubArch()), GLRunnerArgs: params.GitLabRunnerArgs(params.LinuxGitLabArch()), Tags: viper.GetStringMapString(params.Tags), @@ -89,7 +88,6 @@ func getCreateWindowsDesktop() *cobra.Command { params.AddComputeRequestFlags(flagSet) params.AddSpotFlags(flagSet) params.AddGHActionsFlags(flagSet) - params.AddCirrusFlags(flagSet) params.AddGitLabRunnerFlags(flagSet) c.PersistentFlags().AddFlagSet(flagSet) return c diff --git a/cmd/mapt/cmd/ibmcloud/hosts/ibm-power.go b/cmd/mapt/cmd/ibmcloud/hosts/ibm-power.go index c8ca90508..38a6d3d88 100644 --- a/cmd/mapt/cmd/ibmcloud/hosts/ibm-power.go +++ b/cmd/mapt/cmd/ibmcloud/hosts/ibm-power.go @@ -52,7 +52,6 @@ func ibmPowerCreate() *cobra.Command { ResultsOutput: viper.GetString(params.ConnectionDetailsOutput), Debug: viper.IsSet(params.Debug), DebugLevel: viper.GetUint(params.DebugLevel), - CirrusPWArgs: params.CirrusPersistentWorkerArgs(), GHRunnerArgs: params.GithubRunnerArgs(&github.Ppc64le), GLRunnerArgs: params.GitLabRunnerArgs(&gitlab.Ppc64le), Tags: viper.GetStringMapString(params.Tags), @@ -93,7 +92,6 @@ func ibmPowerCreate() *cobra.Command { flagSet.String(params.PIStorageType, params.PIStorageTypeDefault, params.PIStorageTypeDesc) flagSet.Int(params.PIDiskSize, params.PIDiskSizeDefault, params.PIDiskSizeDesc) params.AddGHActionsFlags(flagSet) - params.AddCirrusFlags(flagSet) params.AddGitLabRunnerFlags(flagSet) flagSet.Int(params.GlRunnerConcurrent, params.GlRunnerConcurrentPowerDefault, params.GlRunnerConcurrentDesc) c.PersistentFlags().AddFlagSet(flagSet) diff --git a/cmd/mapt/cmd/ibmcloud/hosts/ibm-z.go b/cmd/mapt/cmd/ibmcloud/hosts/ibm-z.go index 8b3f2929c..ab9bfd293 100644 --- a/cmd/mapt/cmd/ibmcloud/hosts/ibm-z.go +++ b/cmd/mapt/cmd/ibmcloud/hosts/ibm-z.go @@ -52,7 +52,6 @@ func ibmZCreate() *cobra.Command { ResultsOutput: viper.GetString(params.ConnectionDetailsOutput), Debug: viper.IsSet(params.Debug), DebugLevel: viper.GetUint(params.DebugLevel), - CirrusPWArgs: params.CirrusPersistentWorkerArgs(), GHRunnerArgs: params.GithubRunnerArgs(&github.S390x), GLRunnerArgs: params.GitLabRunnerArgs(&gitlab.S390x), Tags: viper.GetStringMapString(params.Tags), @@ -81,7 +80,6 @@ func ibmZCreate() *cobra.Command { flagSet.String(params.IZProfile, params.IZProfileDefault, params.IZProfileDesc) flagSet.Int(params.IZDiskSize, params.IZDiskSizeDefault, params.IZDiskSizeDesc) params.AddGHActionsFlags(flagSet) - params.AddCirrusFlags(flagSet) params.AddGitLabRunnerFlags(flagSet) flagSet.Int(params.GlRunnerConcurrent, params.GlRunnerConcurrentS390xDefault, params.GlRunnerConcurrentDesc) c.PersistentFlags().AddFlagSet(flagSet) diff --git a/cmd/mapt/cmd/params/params.go b/cmd/mapt/cmd/params/params.go index 0aba2dcb0..56f1e87a6 100644 --- a/cmd/mapt/cmd/params/params.go +++ b/cmd/mapt/cmd/params/params.go @@ -3,7 +3,6 @@ package params import ( "os" - "github.com/redhat-developer/mapt/pkg/integrations/cirrus" "github.com/redhat-developer/mapt/pkg/integrations/github" "github.com/redhat-developer/mapt/pkg/integrations/gitlab" cr "github.com/redhat-developer/mapt/pkg/provider/api/compute-request" @@ -92,11 +91,6 @@ const ( ghActionsAppPrivateKey string = "ghactions-app-private-key" ghActionsAppPrivateKeyDesc string = "Path to the GitHub App RSA private key PEM file" - cirrusPWToken string = "it-cirrus-pw-token" - cirrusPWTokenDesc string = "Add mapt target as a cirrus persistent worker. The value will hold a valid token to be used by cirrus cli to join the project." - cirrusPWLabels string = "it-cirrus-pw-labels" - cirrusPWLabelsDesc string = "additional labels to use on the persistent worker (--it-cirrus-pw-labels key1=value1,key2=value2)" - glRunnerToken string = "glrunner-token" glRunnerTokenDesc string = "GitLab token with create_runner scope (personal access token, group/project access token, or service account token)" glRunnerProjectID string = "glrunner-project-id" @@ -425,11 +419,6 @@ func GithubRunnerDeregisterArgs(arch *github.Arch) *github.GithubRunnerArgs { } } -func AddCirrusFlags(fs *pflag.FlagSet) { - fs.StringP(cirrusPWToken, "", "", cirrusPWTokenDesc) - fs.StringToStringP(cirrusPWLabels, "", nil, cirrusPWLabelsDesc) -} - func AddGitLabRunnerFlags(fs *pflag.FlagSet) { fs.StringP(glRunnerToken, "", "", glRunnerTokenDesc) fs.StringP(glRunnerProjectID, "", "", glRunnerProjectIDDesc) @@ -440,19 +429,6 @@ func AddGitLabRunnerFlags(fs *pflag.FlagSet) { } -func CirrusPersistentWorkerArgs() *cirrus.PersistentWorkerArgs { - if viper.IsSet(cirrusPWToken) { - return &cirrus.PersistentWorkerArgs{ - Token: viper.GetString(cirrusPWToken), - Labels: viper.GetStringMapString(cirrusPWLabels), - Platform: &cirrus.Linux, - Arch: linuxArchAsCirrusArch( - viper.GetString(LinuxArch)), - } - } - return nil -} - func GitLabRunnerArgs(arch *gitlab.Arch) *gitlab.GitLabRunnerArgs { if viper.IsSet(glRunnerToken) { if viper.IsSet(glRunnerProjectID) && viper.IsSet(glRunnerGroupID) { @@ -478,14 +454,6 @@ func LinuxGitLabArch() *gitlab.Arch { return linuxArchAsGitLabArch(viper.GetString(LinuxArch)) } -func linuxArchAsCirrusArch(arch string) *cirrus.Arch { - switch arch { - case "x86_64": - return &cirrus.Amd64 - } - return &cirrus.Arm64 -} - func LinuxGithubArch() *github.Arch { return linuxArchAsGithubActionsArch(viper.GetString(LinuxArch)) } @@ -502,14 +470,6 @@ func linuxArchAsGithubActionsArch(arch string) *github.Arch { return &github.Arm64 } -func MACArchAsCirrusArch(arch string) *cirrus.Arch { - switch arch { - case "x86": - return &cirrus.Amd64 - } - return &cirrus.Arm64 -} - func linuxArchAsGitLabArch(arch string) *gitlab.Arch { switch arch { case "x86_64": diff --git a/docs/ibmcloud/ibm-power.md b/docs/ibmcloud/ibm-power.md index cfff6033d..959ed9696 100644 --- a/docs/ibmcloud/ibm-power.md +++ b/docs/ibmcloud/ibm-power.md @@ -43,8 +43,6 @@ Flags: --ghactions-runner-repo string Full URL of the repository where the Github Actions Runner should be registered --ghactions-runner-token string Token needed for registering the Github Actions Runner token -h, --help help for create - --it-cirrus-pw-labels stringToString additional labels to use on the persistent worker (--it-cirrus-pw-labels key1=value1,key2=value2) (default []) - --it-cirrus-pw-token string Add mapt target as a cirrus persistent worker. The value will hold a valid token to be used by cirrus cli to join the project. --otel-app-code string OpenTelemetry appcode identifier (e.g. MAPT-001); when set together with --otel-auth-token, installs the otelcol-contrib filelog collector on the instance --otel-auth-token string OpenTelemetry authentication token (UUID) used to authenticate against the OTLP endpoint --otel-endpoint string OTLP HTTP endpoint to export logs to (default "https://otel-input.corp.redhat.com") diff --git a/docs/ibmcloud/ibm-z.md b/docs/ibmcloud/ibm-z.md index f8ce07f80..ce86e1903 100644 --- a/docs/ibmcloud/ibm-z.md +++ b/docs/ibmcloud/ibm-z.md @@ -34,8 +34,6 @@ Flags: --ghactions-runner-repo string Full URL of the repository where the Github Actions Runner should be registered --ghactions-runner-token string Token needed for registering the Github Actions Runner token -h, --help help for create - --it-cirrus-pw-labels stringToString additional labels to use on the persistent worker (--it-cirrus-pw-labels key1=value1,key2=value2) (default []) - --it-cirrus-pw-token string Add mapt target as a cirrus persistent worker. The value will hold a valid token to be used by cirrus cli to join the project. --otel-app-code string OpenTelemetry appcode identifier (e.g. MAPT-001); when set together with --otel-auth-token, installs the otelcol-contrib filelog collector on the instance --otel-auth-token string OpenTelemetry authentication token (UUID) used to authenticate against the OTLP endpoint --otel-endpoint string OTLP HTTP endpoint to export logs to (default "https://otel-input.corp.redhat.com") diff --git a/pkg/integrations/cirrus/persistentworker.go b/pkg/integrations/cirrus/persistentworker.go deleted file mode 100644 index 42b3d458b..000000000 --- a/pkg/integrations/cirrus/persistentworker.go +++ /dev/null @@ -1,103 +0,0 @@ -package cirrus - -import ( - _ "embed" - "fmt" - "strconv" - "strings" - - "github.com/redhat-developer/mapt/pkg/integrations" - "github.com/redhat-developer/mapt/pkg/util" -) - -//go:embed snippet-darwin.sh -var snippetDarwin []byte - -//go:embed snippet-linux.sh -var snippetLinux []byte - -//go:embed snippet-windows.ps1 -var snippetWindows []byte - -var snippets map[Platform][]byte = map[Platform][]byte{ - Darwin: snippetDarwin, - Linux: snippetLinux, - Windows: snippetWindows} - -var ( - version = "v0.135.0" - baseURL = "https://github.com/cirruslabs/cirrus-cli/releases/download/%s/cirrus-%s-%s" -) - -var pwa *PersistentWorkerArgs - -func Init(args *PersistentWorkerArgs) { - pwa = args -} - -func (args *PersistentWorkerArgs) GetUserDataValues() *integrations.UserDataValues { - if args == nil { - return nil - } - return &integrations.UserDataValues{ - CliURL: downloadURL(), - Name: pwa.Name, - Token: pwa.Token, - Labels: getLabelsAsString(), - Port: cirrusPort, - } -} - -func (args *PersistentWorkerArgs) GetSetupScriptTemplate() string { - templateConfig := string(snippets[*pwa.Platform][:]) - return templateConfig -} - -func GetRunnerArgs() *PersistentWorkerArgs { - return pwa -} - -// If cirrus is enable it will return -// the port to be opened -func CirrusPort() (*int, error) { - if pwa == nil { - return nil, nil - } - port, err := strconv.Atoi(cirrusPort) - return &port, err -} - -// Get token -func GetToken() string { - return util.IfNillable(pwa != nil, - func() string { return pwa.Token }, - "") -} - -// platform: darwin, linux, windows -// arch: amd64, arm64 -func downloadURL() string { - url := fmt.Sprintf(baseURL, version, *pwa.Platform, *pwa.Arch) - if pwa.Platform == &Windows { - url = fmt.Sprintf("%s.exe", url) - } - return url -} - -// Get labels in format -func getLabelsAsString() string { - return util.IfNillable(pwa != nil, - func() string { - if len(pwa.Labels) > 0 { - return strings.Join(func() []string { - out := make([]string, 0, len(pwa.Labels)) - for k, v := range pwa.Labels { - out = append(out, fmt.Sprintf("%s=%s", k, v)) - } - return out - }(), ",") - } - return "" - }, - "") -} diff --git a/pkg/integrations/cirrus/snippet-darwin.sh b/pkg/integrations/cirrus/snippet-darwin.sh deleted file mode 100644 index d593dfe5b..000000000 --- a/pkg/integrations/cirrus/snippet-darwin.sh +++ /dev/null @@ -1,47 +0,0 @@ -# Download cirrus cli -sudo curl -o /usr/local/bin/cirrus -L {{.CliURL}} -sudo chmod +x /usr/local/bin/cirrus - -# Create launchd - -cd /tmp - -cat << EOF > com.cirrus.client.plist - - - - - Label - com.cirrus.client - ProgramArguments - - /usr/local/bin/cirrus - worker - run - --name - {{.Name}} - --token - {{.Token}} -{{ if .Labels }} - --labels - {{.Labels}} -{{ end }} - - RunAtLoad - - UserName - {{.User}} - GroupName - staff - StandardOutPath - /tmp/com.cirrus.client.out.log - StandardErrorPath - /tmp/com.cirrus.client.err.log - - -EOF - -sudo mv com.cirrus.client.plist /Library/LaunchDaemons/ -sudo chown root:wheel /Library/LaunchDaemons/com.cirrus.client.plist -sudo chmod 644 /Library/LaunchDaemons/com.cirrus.client.plist -sudo launchctl load /Library/LaunchDaemons/com.cirrus.client.plist \ No newline at end of file diff --git a/pkg/integrations/cirrus/snippet-linux.sh b/pkg/integrations/cirrus/snippet-linux.sh deleted file mode 100644 index 71469f06f..000000000 --- a/pkg/integrations/cirrus/snippet-linux.sh +++ /dev/null @@ -1,26 +0,0 @@ -# Download cirrus -curl -o /usr/local/bin/cirrus \ - -L {{.CliURL}} -chmod +x /usr/local/bin/cirrus -# Create service -cd /etc/systemd/system -cat << EOF > cirrus.service -[Unit] -Description=cirrus client -After=network.target -[Service] -User={{.User}} -WorkingDirectory=/home/{{.User}} -ExecStart=/usr/local/bin/cirrus worker run --name {{.Name}} \ - --token {{.Token}}{{ if .Labels }} \ - --labels {{.Labels}}{{ end }} -Restart=always -RestartSec=5 -Environment="PATH=/usr/local/bin:/usr/bin:/bin" -[Install] -WantedBy=multi-user.target -EOF -systemctl daemon-reload -systemctl enable cirrus.service -systemctl start cirrus.service -systemctl status cirrus.service \ No newline at end of file diff --git a/pkg/integrations/cirrus/snippet-windows.ps1 b/pkg/integrations/cirrus/snippet-windows.ps1 deleted file mode 100644 index 46f6d6df5..000000000 --- a/pkg/integrations/cirrus/snippet-windows.ps1 +++ /dev/null @@ -1,9 +0,0 @@ -# Download cirrus cli -curl.exe -o C:\Users\{{.User}}\AppData\Local\Microsoft\WindowsApps\cirrus.exe -L {{.CliURL}} - -# Create startup bat to run cirrus -$cirrusCMD="cirrus.exe worker run --name {{.Name}} --token $cirrusToken " -{{ if .Labels }} -$cirrusCMD="$cirrusCMD --labels {{.Labels}}" -{{ end }} -New-Item -Path "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp" -Name start-cirrus.bat -ItemType "file" -Value "powershell -command `"$cirrusCMD`"" diff --git a/pkg/integrations/cirrus/types.go b/pkg/integrations/cirrus/types.go deleted file mode 100644 index 31f94d8df..000000000 --- a/pkg/integrations/cirrus/types.go +++ /dev/null @@ -1,23 +0,0 @@ -package cirrus - -type Platform string -type Arch string - -var ( - cirrusPort = "3010" - - Windows Platform = "windows" - Linux Platform = "linux" - Darwin Platform = "darwin" - - Arm64 Arch = "arm64" - Amd64 Arch = "amd64" -) - -type PersistentWorkerArgs struct { - Name string - Token string - Platform *Platform - Arch *Arch - Labels map[string]string -} diff --git a/pkg/integrations/integrations.go b/pkg/integrations/integrations.go index ed9395f18..cbf686d0f 100644 --- a/pkg/integrations/integrations.go +++ b/pkg/integrations/integrations.go @@ -38,16 +38,8 @@ func GetIntegrationSnippet(intCfg IntegrationConfig, username string) (*string, return &snippet, err } -// If we add the snippet as part of a cloud init file the strategy -// would be create the file with write_files: -// i.e. -// write_files: -// -// # Cirrus service setup -// - content: | -// {{ .CirrusSnippet }} <----- 6 spaces -// -// to do so we need to indent 6 spaces each line of the snippet +// GetIntegrationSnippetAsCloudInitWritableFile wraps GetIntegrationSnippet +// and indents the result for use inside a cloud-init write_files block. func GetIntegrationSnippetAsCloudInitWritableFile(intCfg IntegrationConfig, username string) (*string, error) { snippet, err := GetIntegrationSnippet(intCfg, username) if err != nil || len(*snippet) == 0 { diff --git a/pkg/manager/context/context.go b/pkg/manager/context/context.go index f98066bce..8df80d48c 100644 --- a/pkg/manager/context/context.go +++ b/pkg/manager/context/context.go @@ -7,7 +7,6 @@ import ( "maps" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" - "github.com/redhat-developer/mapt/pkg/integrations/cirrus" "github.com/redhat-developer/mapt/pkg/integrations/github" "github.com/redhat-developer/mapt/pkg/integrations/gitlab" "github.com/redhat-developer/mapt/pkg/util" @@ -50,7 +49,6 @@ type ContextArgs struct { KeepState bool // integrations GHRunnerArgs *github.GithubRunnerArgs - CirrusPWArgs *cirrus.PersistentWorkerArgs GLRunnerArgs *gitlab.GitLabRunnerArgs } @@ -186,10 +184,6 @@ func manageIntegration(c *Context, ca *ContextArgs) error { ca.GHRunnerArgs.Name = c.ProjectName() github.Init(ca.GHRunnerArgs) } - if ca.CirrusPWArgs != nil { - ca.CirrusPWArgs.Name = c.RunID() - cirrus.Init(ca.CirrusPWArgs) - } if ca.GLRunnerArgs != nil { ca.GLRunnerArgs.Name = c.ProjectName() gitlab.Init(ca.GLRunnerArgs) diff --git a/pkg/provider/aws/action/eks/eks.go b/pkg/provider/aws/action/eks/eks.go index 3765eb828..0a2602eb8 100644 --- a/pkg/provider/aws/action/eks/eks.go +++ b/pkg/provider/aws/action/eks/eks.go @@ -17,7 +17,6 @@ import ( "github.com/pulumi/pulumi/sdk/v3/go/auto" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" "github.com/pulumi/pulumi/sdk/v3/go/pulumix" - "github.com/redhat-developer/mapt/pkg/integrations/cirrus" "github.com/redhat-developer/mapt/pkg/manager" mc "github.com/redhat-developer/mapt/pkg/manager/context" infra "github.com/redhat-developer/mapt/pkg/provider" @@ -334,22 +333,6 @@ func (r *eksRequest) securityGroups(ctx *pulumi.Context, sshIngressRule := securityGroup.SSH_TCP sshIngressRule.CidrBlocks = infra.NETWORKING_CIDR_ANY_IPV4 ingressRules = []securityGroup.IngressRules{sshIngressRule} - // Integration ports - cirrusPort, err := cirrus.CirrusPort() - if err != nil { - return nil, err - } - if cirrusPort != nil { - ingressRules = append(ingressRules, - securityGroup.IngressRules{ - Description: fmt.Sprintf("Cirrus port for %s", awsEKSID), - FromPort: *cirrusPort, - ToPort: *cirrusPort, - Protocol: "tcp", - CidrBlocks: infra.NETWORKING_CIDR_ANY_IPV4, - }) - } - // Create SG with ingress rules sg, err := securityGroup.SGRequest{ Name: resourcesUtil.GetResourceName(*r.prefix, awsEKSID, "sg"), diff --git a/pkg/provider/aws/action/fedora/fedora.go b/pkg/provider/aws/action/fedora/fedora.go index 8fae8ad8c..9179fbc2a 100644 --- a/pkg/provider/aws/action/fedora/fedora.go +++ b/pkg/provider/aws/action/fedora/fedora.go @@ -7,7 +7,6 @@ import ( "github.com/pulumi/pulumi-aws/sdk/v7/go/aws/ec2" "github.com/pulumi/pulumi/sdk/v3/go/auto" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" - "github.com/redhat-developer/mapt/pkg/integrations/cirrus" "github.com/redhat-developer/mapt/pkg/integrations/github" "github.com/redhat-developer/mapt/pkg/manager" mc "github.com/redhat-developer/mapt/pkg/manager/context" @@ -319,22 +318,6 @@ func securityGroups(ctx *pulumi.Context, mCtx *mc.Context, prefix *string, sshIngressRule := securityGroup.SSH_TCP sshIngressRule.CidrBlocks = infra.NETWORKING_CIDR_ANY_IPV4 ingressRules = []securityGroup.IngressRules{sshIngressRule} - // Integration ports - cirrusPort, err := cirrus.CirrusPort() - if err != nil { - return nil, err - } - if cirrusPort != nil { - ingressRules = append(ingressRules, - securityGroup.IngressRules{ - Description: fmt.Sprintf("Cirrus port for %s", awsFedoraDedicatedID), - FromPort: *cirrusPort, - ToPort: *cirrusPort, - Protocol: "tcp", - CidrBlocks: infra.NETWORKING_CIDR_ANY_IPV4, - }) - } - // Create SG with ingress rules sg, err := securityGroup.SGRequest{ Name: resourcesUtil.GetResourceName(*prefix, awsFedoraDedicatedID, "sg"), diff --git a/pkg/provider/aws/action/mac-pool/mac-pool.go b/pkg/provider/aws/action/mac-pool/mac-pool.go index 69d5c93b3..a9cf2816e 100644 --- a/pkg/provider/aws/action/mac-pool/mac-pool.go +++ b/pkg/provider/aws/action/mac-pool/mac-pool.go @@ -136,8 +136,6 @@ func Request(mCtxArgs *mc.ContextArgs, r *RequestMachineArgs) error { Timeout: r.Timeout, } - // TODO here we would change based on the integration-mode requested - // possible values remote-shh, gh-selfhosted-runner, cirrus-persistent-worker err = mr.ManageRequest(hi) if err != nil { return err diff --git a/pkg/provider/aws/modules/mac/machine/machine.go b/pkg/provider/aws/modules/mac/machine/machine.go index 8ebf6e7ec..2f091edea 100644 --- a/pkg/provider/aws/modules/mac/machine/machine.go +++ b/pkg/provider/aws/modules/mac/machine/machine.go @@ -5,7 +5,6 @@ import ( "errors" "fmt" - "github.com/redhat-developer/mapt/pkg/integrations/cirrus" "github.com/redhat-developer/mapt/pkg/manager" infra "github.com/redhat-developer/mapt/pkg/provider" "github.com/redhat-developer/mapt/pkg/provider/aws" @@ -302,21 +301,6 @@ func (r *Request) securityGroups(ctx *pulumi.Context, } ingressRules := []securityGroup.IngressRules{ sshIngressRule, vncIngressRule} - // Integration ports - cirrusPort, err := cirrus.CirrusPort() - if err != nil { - return nil, err - } - if cirrusPort != nil { - ingressRules = append(ingressRules, - securityGroup.IngressRules{ - Description: fmt.Sprintf("Cirrus port for %s", awsMacMachineID), - FromPort: *cirrusPort, - ToPort: *cirrusPort, - Protocol: "tcp", - CidrBlocks: infra.NETWORKING_CIDR_ANY_IPV4, - }) - } // Create SG with ingress rules sg, err := securityGroup.SGRequest{ Name: resourcesUtil.GetResourceName(r.Prefix, awsMacMachineID, "sg"), diff --git a/pkg/provider/aws/modules/mac/machine/setup/request.sh b/pkg/provider/aws/modules/mac/machine/setup/request.sh index 1681a647e..e702b1dcc 100644 --- a/pkg/provider/aws/modules/mac/machine/setup/request.sh +++ b/pkg/provider/aws/modules/mac/machine/setup/request.sh @@ -29,8 +29,6 @@ echo "{{.AuthorizedKey}}" | tee /Users/{{.Username}}/.ssh/authorized_keys {{ .ActionsRunnerSnippet }} -{{ .CirrusSnippet }} - {{ .GitLabSnippet }} # autologin to take effect diff --git a/pkg/provider/aws/modules/mac/machine/setup/setup.go b/pkg/provider/aws/modules/mac/machine/setup/setup.go index e80727534..e88d15874 100644 --- a/pkg/provider/aws/modules/mac/machine/setup/setup.go +++ b/pkg/provider/aws/modules/mac/machine/setup/setup.go @@ -6,7 +6,6 @@ import ( "github.com/pulumi/pulumi-random/sdk/v4/go/random" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" "github.com/redhat-developer/mapt/pkg/integrations" - "github.com/redhat-developer/mapt/pkg/integrations/cirrus" "github.com/redhat-developer/mapt/pkg/integrations/github" "github.com/redhat-developer/mapt/pkg/integrations/gitlab" "github.com/redhat-developer/mapt/pkg/util/file" @@ -30,7 +29,6 @@ type requestDataValues struct { NewPassword string AuthorizedKey string ActionsRunnerSnippet string - CirrusSnippet string GitLabSnippet string } @@ -44,10 +42,6 @@ func Release(username, pass, authorizedKey string) (string, error) { } func Request(username, oldPassword, newPassword, authorizedKey string) (string, error) { - cirrusSnippet, err := integrations.GetIntegrationSnippet(cirrus.GetRunnerArgs(), username) - if err != nil { - return "", err - } ghActionsRunnerSnippet, err := integrations.GetIntegrationSnippet(github.GetRunnerArgs(), username) if err != nil { return "", err @@ -63,7 +57,6 @@ func Request(username, oldPassword, newPassword, authorizedKey string) (string, newPassword, authorizedKey, *ghActionsRunnerSnippet, - *cirrusSnippet, *gitlabSnippet}, string(RequestScript[:])) } diff --git a/pkg/provider/azure/action/windows/rhqp-ci-setup.ps1 b/pkg/provider/azure/action/windows/rhqp-ci-setup.ps1 index 857b7ccc2..5ff74ec3e 100644 --- a/pkg/provider/azure/action/windows/rhqp-ci-setup.ps1 +++ b/pkg/provider/azure/action/windows/rhqp-ci-setup.ps1 @@ -9,8 +9,6 @@ param( $authorizedKey, [Parameter(HelpMessage='token for the github actions runner')] $ghToken, - [Parameter(HelpMessage='token for the cirrus persistent worker')] - $cirrusToken, [Parameter(HelpMessage='token for the gitlab runner')] $gitlabToken, [switch]$crcProfile=$false @@ -153,8 +151,6 @@ if ($crcProfile) { # Install github-actions-runner if needed {{ .ActionsRunnerSnippet }} -{{ .CirrusSnippet }} - {{ .GitLabSnippet }} # Restart computer to have the ssh connection available with setup from this script diff --git a/pkg/provider/azure/action/windows/windows.go b/pkg/provider/azure/action/windows/windows.go index f9650eda3..7385ecbee 100644 --- a/pkg/provider/azure/action/windows/windows.go +++ b/pkg/provider/azure/action/windows/windows.go @@ -14,7 +14,6 @@ import ( "github.com/pulumi/pulumi/sdk/v3/go/auto" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" "github.com/redhat-developer/mapt/pkg/integrations" - "github.com/redhat-developer/mapt/pkg/integrations/cirrus" "github.com/redhat-developer/mapt/pkg/integrations/github" "github.com/redhat-developer/mapt/pkg/integrations/gitlab" "github.com/redhat-developer/mapt/pkg/manager" @@ -76,7 +75,6 @@ func (r *windowsRequest) validate() error { type ghActionsRunnerData struct { ActionsRunnerSnippet string - CirrusSnippet string GitLabSnippet string } @@ -349,14 +347,13 @@ func (r *windowsRequest) postInitSetup(ctx *pulumi.Context, rg *resources.Resour defer gitlab.SetAuthToken("") return fmt.Sprintf( - "powershell -ExecutionPolicy Unrestricted -File %s %s -userPass \"%s\" -user %s -hostname %s -ghToken \"%s\" -cirrusToken \"%s\" -gitlabToken \"%s\" -authorizedKey \"%s\"", + "powershell -ExecutionPolicy Unrestricted -File %s %s -userPass \"%s\" -user %s -hostname %s -ghToken \"%s\" -gitlabToken \"%s\" -authorizedKey \"%s\"", scriptName, r.profilesAsParams(), password, *r.username, *hostname, github.GetToken(), - cirrus.GetToken(), gitlabToken, authorizedKey, ) @@ -369,14 +366,13 @@ func (r *windowsRequest) postInitSetup(ctx *pulumi.Context, rg *resources.Resour authorizedKey := args[1].(string) hostname := args[2].(*string) return fmt.Sprintf( - "powershell -ExecutionPolicy Unrestricted -File %s %s -userPass \"%s\" -user %s -hostname %s -ghToken \"%s\" -cirrusToken \"%s\" -gitlabToken \"%s\" -authorizedKey \"%s\"", + "powershell -ExecutionPolicy Unrestricted -File %s %s -userPass \"%s\" -user %s -hostname %s -ghToken \"%s\" -gitlabToken \"%s\" -authorizedKey \"%s\"", scriptName, r.profilesAsParams(), password, *r.username, *hostname, github.GetToken(), - cirrus.GetToken(), gitlab.GetToken(), authorizedKey, ) @@ -438,10 +434,6 @@ func (r *windowsRequest) uploadScript(ctx *pulumi.Context, if err != nil { return nil, err } - cirrusSnippet, err := integrations.GetIntegrationSnippet(cirrus.GetRunnerArgs(), *r.username) - if err != nil { - return nil, err - } ghActionsRunnerSnippet, err := integrations.GetIntegrationSnippet(github.GetRunnerArgs(), *r.username) if err != nil { return nil, err @@ -454,7 +446,6 @@ func (r *windowsRequest) uploadScript(ctx *pulumi.Context, ciSetupScript, err := file.Template( ghActionsRunnerData{ *ghActionsRunnerSnippet, - *cirrusSnippet, *gitlabSnippet, }, string(RHQPCISetupScript)) diff --git a/pkg/target/host/fedora/cloud-config b/pkg/target/host/fedora/cloud-config index 68c5f8875..d964f15c6 100644 --- a/pkg/target/host/fedora/cloud-config +++ b/pkg/target/host/fedora/cloud-config @@ -12,7 +12,6 @@ ntp: runcmd: - dnf install -y podman {{ if .ActionsRunnerSnippet }} - sudo -u {{ .Username }} bash -c /opt/install-ghrunner.sh{{ end }} -{{ if .CirrusSnippet }} - /opt/setup-cirrus-service.sh{{ end }} {{ if .GitLabSnippet }} - sudo -u {{ .Username }} bash -c /opt/install-glrunner.sh{{ end }} {{ if .ActionsRunnerSnippet }}write_files: - content: | @@ -20,12 +19,6 @@ runcmd: path: /opt/install-ghrunner.sh permissions: '0755' {{ end }} -{{ if .CirrusSnippet }}write_files: - - content: | -{{.CirrusSnippet}} - path: /opt/setup-cirrus-service.sh - permissions: '0755' -{{ end }} {{ if .GitLabSnippet }}write_files: - content: | {{.GitLabSnippet}} diff --git a/pkg/target/host/fedora/fedora.go b/pkg/target/host/fedora/fedora.go index 935bcf066..b0642d38d 100644 --- a/pkg/target/host/fedora/fedora.go +++ b/pkg/target/host/fedora/fedora.go @@ -6,7 +6,6 @@ import ( "github.com/pulumi/pulumi/sdk/v3/go/pulumi" "github.com/redhat-developer/mapt/pkg/integrations" - "github.com/redhat-developer/mapt/pkg/integrations/cirrus" "github.com/redhat-developer/mapt/pkg/integrations/github" "github.com/redhat-developer/mapt/pkg/integrations/gitlab" "github.com/redhat-developer/mapt/pkg/util/file" @@ -15,7 +14,6 @@ import ( type userDataValues struct { Username string ActionsRunnerSnippet string - CirrusSnippet string GitLabSnippet string } @@ -23,10 +21,6 @@ type userDataValues struct { var CloudConfig []byte func Userdata(amiUser string) (pulumi.StringPtrInput, error) { - cirrusSnippet, err := integrations.GetIntegrationSnippetAsCloudInitWritableFile(cirrus.GetRunnerArgs(), amiUser) - if err != nil { - return nil, err - } ghActionsRunnerSnippet, err := integrations.GetIntegrationSnippetAsCloudInitWritableFile(github.GetRunnerArgs(), amiUser) if err != nil { return nil, err @@ -41,7 +35,6 @@ func Userdata(amiUser string) (pulumi.StringPtrInput, error) { userDataValues{ amiUser, *ghActionsRunnerSnippet, - *cirrusSnippet, *gitlabSnippet}, templateConfig) return pulumi.String(base64.StdEncoding.EncodeToString([]byte(userdata))), err @@ -55,10 +48,6 @@ func UserdataWithGitLabToken(amiUser string, gitlabAuthToken string) (string, er defer gitlab.SetAuthToken("") // Clear after use // Generate userdata as normal - cirrusSnippet, err := integrations.GetIntegrationSnippetAsCloudInitWritableFile(cirrus.GetRunnerArgs(), amiUser) - if err != nil { - return "", err - } ghActionsRunnerSnippet, err := integrations.GetIntegrationSnippetAsCloudInitWritableFile(github.GetRunnerArgs(), amiUser) if err != nil { return "", err @@ -73,7 +62,6 @@ func UserdataWithGitLabToken(amiUser string, gitlabAuthToken string) (string, er userDataValues{ amiUser, *ghActionsRunnerSnippet, - *cirrusSnippet, *gitlabSnippet}, templateConfig) if err != nil { diff --git a/pkg/target/host/rhel/cloud-config-base b/pkg/target/host/rhel/cloud-config-base index ea946c52b..cda967532 100644 --- a/pkg/target/host/rhel/cloud-config-base +++ b/pkg/target/host/rhel/cloud-config-base @@ -12,9 +12,8 @@ runcmd: - while fuser /var/lib/rpm/.rpm.lock > /dev/null 2>&1 ; do sleep 1 ; done - dnf install -y podman {{ if .ActionsRunnerSnippet }} - sudo -u {{ .Username }} bash -c /opt/install-ghrunner.sh{{ end }} -{{ if .CirrusSnippet }} - /opt/setup-cirrus-service.sh{{ end }} {{ if .GitLabSnippet }} - sudo -u {{ .Username }} bash -c /opt/install-glrunner.sh{{ end }} -{{- if or .ExpandRootDisk .ActionsRunnerSnippet .CirrusSnippet .GitLabSnippet }} +{{- if or .ExpandRootDisk .ActionsRunnerSnippet .GitLabSnippet }} write_files: {{- if .ExpandRootDisk }} - path: /usr/local/bin/expand-root-disk.sh @@ -29,12 +28,6 @@ write_files: path: /opt/install-ghrunner.sh permissions: '0755' {{ end }} -{{ if .CirrusSnippet }} - - content: | -{{.CirrusSnippet}} - path: /opt/setup-cirrus-service.sh - permissions: '0755' -{{ end }} {{ if .GitLabSnippet }} - content: | {{.GitLabSnippet}} diff --git a/pkg/target/host/rhel/cloud-config-snc b/pkg/target/host/rhel/cloud-config-snc index fc64b8672..6dd4351a2 100644 --- a/pkg/target/host/rhel/cloud-config-snc +++ b/pkg/target/host/rhel/cloud-config-snc @@ -18,7 +18,6 @@ runcmd: - echo "user.max_user_namespaces=28633" | tee -a /etc/sysctl.d/userns.conf - sysctl -p /etc/sysctl.d/userns.conf {{ if .ActionsRunnerSnippet }} - sudo -u {{ .Username }} bash -c /opt/install-ghrunner.sh {{ end }} -{{ if .CirrusSnippet }} - /opt/setup-cirrus-service.sh{{ end }} {{ if .GitLabSnippet }} - sudo -u {{ .Username }} bash -c /opt/install-glrunner.sh{{ end }} {{ if .ActionsRunnerSnippet }}write_files: # Github actions runner installation @@ -27,12 +26,6 @@ runcmd: path: /opt/install-ghrunner.sh permissions: '0755' {{ end }} -{{ if .CirrusSnippet }}write_files: - - content: | -{{.CirrusSnippet}} - path: /opt/setup-cirrus-service.sh - permissions: '0755' -{{ end }} {{ if .GitLabSnippet }}write_files: - content: | {{.GitLabSnippet}} diff --git a/pkg/target/host/rhel/cloud-config.go b/pkg/target/host/rhel/cloud-config.go index 8d111ee83..06705e796 100644 --- a/pkg/target/host/rhel/cloud-config.go +++ b/pkg/target/host/rhel/cloud-config.go @@ -6,7 +6,6 @@ import ( "github.com/pulumi/pulumi/sdk/v3/go/pulumi" "github.com/redhat-developer/mapt/pkg/integrations" - "github.com/redhat-developer/mapt/pkg/integrations/cirrus" "github.com/redhat-developer/mapt/pkg/integrations/github" "github.com/redhat-developer/mapt/pkg/integrations/gitlab" cloudinit "github.com/redhat-developer/mapt/pkg/util/cloud-init" @@ -25,7 +24,6 @@ type userDataValues struct { SubscriptionPassword string Username string ActionsRunnerSnippet string - CirrusSnippet string GitLabSnippet string ExpandRootDisk string } @@ -41,10 +39,6 @@ func (r *CloudConfigArgs) CloudConfig() (*string, error) { if r.SNCProfile { templateConfig = string(CloudConfigSNC[:]) } - cirrusSnippet, err := integrations.GetIntegrationSnippetAsCloudInitWritableFile(cirrus.GetRunnerArgs(), r.Username) - if err != nil { - return nil, err - } ghActionsRunnerSnippet, err := integrations.GetIntegrationSnippetAsCloudInitWritableFile(github.GetRunnerArgs(), r.Username) if err != nil { return nil, err @@ -58,7 +52,6 @@ func (r *CloudConfigArgs) CloudConfig() (*string, error) { SubscriptionPassword: r.SubsPassword, Username: r.Username, ActionsRunnerSnippet: *ghActionsRunnerSnippet, - CirrusSnippet: *cirrusSnippet, GitLabSnippet: *gitlabSnippet} if r.ExpandRootDisk != nil { snippet := string(r.ExpandRootDisk[:]) @@ -86,10 +79,6 @@ func (r *CloudConfigArgs) CloudConfigWithGitLabToken(gitlabAuthToken string) (st if r.SNCProfile { templateConfig = string(CloudConfigSNC[:]) } - cirrusSnippet, err := integrations.GetIntegrationSnippetAsCloudInitWritableFile(cirrus.GetRunnerArgs(), r.Username) - if err != nil { - return "", err - } ghActionsRunnerSnippet, err := integrations.GetIntegrationSnippetAsCloudInitWritableFile(github.GetRunnerArgs(), r.Username) if err != nil { return "", err @@ -103,7 +92,6 @@ func (r *CloudConfigArgs) CloudConfigWithGitLabToken(gitlabAuthToken string) (st SubscriptionPassword: r.SubsPassword, Username: r.Username, ActionsRunnerSnippet: *ghActionsRunnerSnippet, - CirrusSnippet: *cirrusSnippet, GitLabSnippet: *gitlabSnippet} if r.ExpandRootDisk != nil { snippet := string(r.ExpandRootDisk[:]) diff --git a/pkg/target/host/windows-server/bootstrap.ps1 b/pkg/target/host/windows-server/bootstrap.ps1 index 894431da3..7d91b8dd0 100644 --- a/pkg/target/host/windows-server/bootstrap.ps1 +++ b/pkg/target/host/windows-server/bootstrap.ps1 @@ -24,11 +24,6 @@ Set-Item .\allowunencrypted $false {{- .ActionsRunnerSnippet }} {{ end }} -{{ if .CirrusSnippet }} -$cirrusToken = {{ .CirrusToken }} -{{ .CirrusSnippet }} -{{ end }} - {{ if .GitLabSnippet }} $gitlabToken = {{ .GitLabToken }} {{ .GitLabSnippet }} diff --git a/pkg/target/host/windows-server/windows-server.go b/pkg/target/host/windows-server/windows-server.go index fdeb50e70..9e1b440e6 100644 --- a/pkg/target/host/windows-server/windows-server.go +++ b/pkg/target/host/windows-server/windows-server.go @@ -7,7 +7,6 @@ import ( "github.com/pulumi/pulumi-random/sdk/v4/go/random" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" "github.com/redhat-developer/mapt/pkg/integrations" - "github.com/redhat-developer/mapt/pkg/integrations/cirrus" "github.com/redhat-developer/mapt/pkg/integrations/github" "github.com/redhat-developer/mapt/pkg/integrations/gitlab" "github.com/redhat-developer/mapt/pkg/provider/aws/services/ec2/keypair" @@ -20,8 +19,6 @@ type userDataValues struct { AuthorizedKey string ActionsRunnerSnippet string RunnerToken string - CirrusSnippet string - CirrusToken string GitLabSnippet string GitLabToken string } @@ -36,10 +33,6 @@ func Userdata(ctx *pulumi.Context, amiUser *string, password *random.RandomPassw func(args []interface{}) (string, error) { password := args[0].(string) authorizedKey := args[1].(string) - cirrusSnippet, err := integrations.GetIntegrationSnippet(cirrus.GetRunnerArgs(), *amiUser) - if err != nil { - return "", err - } ghActionsRunnerSnippet, err := integrations.GetIntegrationSnippet(github.GetRunnerArgs(), *amiUser) if err != nil { return "", err @@ -54,8 +47,6 @@ func Userdata(ctx *pulumi.Context, amiUser *string, password *random.RandomPassw authorizedKey, *ghActionsRunnerSnippet, github.GetToken(), - *cirrusSnippet, - cirrus.GetToken(), *gitlabSnippet, gitlab.GetToken(), } @@ -81,10 +72,6 @@ func UserdataWithGitLabToken(ctx *pulumi.Context, amiUser *string, password *ran gitlab.SetAuthToken(gitlabToken) defer gitlab.SetAuthToken("") - cirrusSnippet, err := integrations.GetIntegrationSnippet(cirrus.GetRunnerArgs(), *amiUser) - if err != nil { - return "", err - } ghActionsRunnerSnippet, err := integrations.GetIntegrationSnippet(github.GetRunnerArgs(), *amiUser) if err != nil { return "", err @@ -99,8 +86,6 @@ func UserdataWithGitLabToken(ctx *pulumi.Context, amiUser *string, password *ran authorizedKey, *ghActionsRunnerSnippet, github.GetToken(), - *cirrusSnippet, - cirrus.GetToken(), *gitlabSnippet, gitlabToken, } diff --git a/pkg/util/cloud-init/util.go b/pkg/util/cloud-init/util.go index 38d3d927a..bc2a7e844 100644 --- a/pkg/util/cloud-init/util.go +++ b/pkg/util/cloud-init/util.go @@ -5,16 +5,8 @@ import ( "strings" ) -// If we add the snippet as part of a cloud init file the strategy -// would be create the file with write_files: -// i.e. -// write_files: -// -// # Cirrus service setup -// - content: | -// {{ .CirrusSnippet }} <----- 6 spaces -// -// to do so we need to indent 6 spaces each line of the snippet +// IndentWriteFile indents each line of snippet by 6 spaces so it can be +// embedded inside a cloud-init write_files content block. func IndentWriteFile(snippet *string) (*string, error) { lines := strings.Split(strings.TrimSpace(*snippet), "\n") for i, line := range lines {