-
Notifications
You must be signed in to change notification settings - Fork 154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ability to generate buildkite pipelines from integration testing framework #5391
Merged
Merged
Changes from 23 commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
e9548d6
Working on buildkite integration runner.
blakerouse 3eadef2
Use correct image for upload pipeline.
blakerouse bbcd41c
Output pipeline for debug.
blakerouse d77c35b
Merge branch 'main' into integration-buildkite
blakerouse 07b355b
Use script to perform pipeline work.
blakerouse 9e6d99d
Remove todo code.
blakerouse ad8e658
Merge remote-tracking branch 'upstream/main' into integration-buildkite
blakerouse 8296324
Fix YAML structure.
blakerouse 9eaecd2
Top-level steps.
blakerouse f9ae937
Make agents an array.
blakerouse 73b86c2
Try YAML v3.
blakerouse 9e7fc99
Switch to JSON.
blakerouse 50878e6
Add json struct tags.
blakerouse 9ccdb9b
Revert JSON and add debug
pazone dd735d6
Renamed the yaml file
pazone b4727c1
Direct pipe upload
pazone b9cd6bb
Direct pipe upload
pazone 22ed6d4
Direct file output from go
pazone 5c4fd37
Merge remote-tracking branch 'origin/integration-buildkite' into inte…
blakerouse 5d93a99
Cleanups.
blakerouse cee4744
mage check
blakerouse 53d6f66
Merge remote-tracking branch 'upstream/main' into integration-buildkite
blakerouse e847415
Cleanup for merge.
blakerouse f5650f8
Refactor all of pkg/testing.
blakerouse 8a1d146
Merge remote-tracking branch 'upstream/main' into integration-buildkite
blakerouse 73f921a
Rename.
blakerouse 4689f18
Cleanup imports.
blakerouse 9cb959d
Fix bad merge.
blakerouse d96f51a
Merge remote-tracking branch 'upstream/main' into integration-buildkite
blakerouse 3ce2196
Fix licensing and imports.
blakerouse 26c72ac
Merge branch 'main' into integration-buildkite
blakerouse 40006ae
Merge branch 'main' into integration-buildkite
blakerouse File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
// or more contributor license agreements. Licensed under the Elastic License 2.0; | ||
// you may not use this file except in compliance with the Elastic License 2.0. | ||
|
||
package buildkite | ||
|
||
type StepAgent struct { | ||
Provider string `json:"provider,omitempty" yaml:"provider,omitempty"` | ||
ImageProject string `json:"imageProject,omitempty" yaml:"imageProject,omitempty"` | ||
MachineType string `json:"machineType,omitempty" yaml:"machineType,omitempty"` | ||
Image string `json:"image,omitempty" yaml:"image,omitempty"` | ||
} | ||
|
||
type Step struct { | ||
Key string `json:"key,omitempty" yaml:"key,omitempty"` | ||
Label string `json:"label,omitempty" yaml:"label,omitempty"` | ||
Command string `json:"command,omitempty" yaml:"command,omitempty"` | ||
Env map[string]string `json:"env,omitempty" yaml:"env,omitempty"` | ||
ArtifactPaths []string `json:"artifact_paths,omitempty" yaml:"artifact_paths,omitempty"` | ||
Agents []StepAgent `json:"agents,omitempty" yaml:"agents,omitempty"` | ||
DependsOn []string `json:"depends_on,omitempty" yaml:"depends_on,omitempty"` | ||
AllowDependencyFailure bool `json:"allow_dependency_failure,omitempty" yaml:"allow_dependency_failure,omitempty"` | ||
Steps []Step `json:"steps,omitempty" yaml:"steps,omitempty"` | ||
Skip bool `json:"skip,omitempty" yaml:"skip,omitempty"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
// or more contributor license agreements. Licensed under the Elastic License 2.0; | ||
// you may not use this file except in compliance with the Elastic License 2.0. | ||
|
||
package null | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/elastic/elastic-agent/pkg/testing/define" | ||
"github.com/elastic/elastic-agent/pkg/testing/runner" | ||
) | ||
|
||
const ( | ||
Name = "null" | ||
) | ||
|
||
type instanceProvisioner struct { | ||
logger runner.Logger | ||
} | ||
|
||
// NewInstanceProvisioner creates the null provisioner | ||
func NewInstanceProvisioner() runner.InstanceProvisioner { | ||
return &instanceProvisioner{} | ||
} | ||
|
||
func (p *instanceProvisioner) Name() string { | ||
return Name | ||
} | ||
|
||
func (p *instanceProvisioner) SetLogger(l runner.Logger) { | ||
p.logger = l | ||
} | ||
|
||
func (p *instanceProvisioner) Type() runner.ProvisionerType { | ||
return runner.ProvisionerTypeVM | ||
} | ||
|
||
func (p *instanceProvisioner) Supported(os define.OS) bool { | ||
return true | ||
} | ||
|
||
func (p *instanceProvisioner) Provision(ctx context.Context, cfg runner.Config, batches []runner.OSBatch) ([]runner.Instance, error) { | ||
return nil, fmt.Errorf("null provisioner cannot provision") | ||
} | ||
|
||
func (p *instanceProvisioner) Clean(ctx context.Context, _ runner.Config, instances []runner.Instance) error { | ||
// nothing to clean | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
// or more contributor license agreements. Licensed under the Elastic License 2.0; | ||
// you may not use this file except in compliance with the Elastic License 2.0. | ||
|
||
package null | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/elastic/elastic-agent/pkg/testing/runner" | ||
) | ||
|
||
type stackProvisioner struct { | ||
log runner.Logger | ||
} | ||
|
||
// NewStackProvisioner creates a new null stack provisioner | ||
func NewStackProvisioner() runner.StackProvisioner { | ||
return &stackProvisioner{} | ||
} | ||
|
||
func (prov *stackProvisioner) Name() string { | ||
return Name | ||
} | ||
|
||
func (prov *stackProvisioner) SetLogger(l runner.Logger) { | ||
prov.log = l | ||
} | ||
|
||
func (prov *stackProvisioner) Create(ctx context.Context, request runner.StackRequest) (runner.Stack, error) { | ||
return runner.Stack{}, fmt.Errorf("null provisioner cannot provision") | ||
} | ||
|
||
func (prov *stackProvisioner) WaitForReady(ctx context.Context, stack runner.Stack) (runner.Stack, error) { | ||
// nothing to wait for | ||
return runner.Stack{}, nil | ||
} | ||
|
||
func (prov *stackProvisioner) Delete(ctx context.Context, stack runner.Stack) error { | ||
// nothing to delete | ||
return nil | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is Buildkite() a method of a runner ?
I understand that there's some convenient code already there but is generating buildkite steps a responsibility of a runner ?
Should an integration test runner know about Buildkite and its step definition?
This looks like a code smell as the runner is probably doing too much
Perhaps the runner logic should be broken up in smaller independent pieces ?
Edit:
What about extracting the batching functionality and dumping the batches in a structured manner so that the buildkite steps can be built from that ?
That should be something that enables the dynamic creation of buildkite steps without introducing tight coupling between integration test runners and buildkite
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer it this way otherwise I would have to expose more internals of the runner for the buildkite runner. Generating buildkite is a unique way of running the testing runner, but either way its still the runner performing the work its just being done through buildkite.
My overall goal of this PR was just to show that it can be done and not something that needed to be hard coded in YAML. The actually work of making this work will be done by @pazone
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pazone Okay, I just went ahead and refactored the runner to allow me to pull it out and not create the runner as you requested. Should be good now.