Skip to content
This repository was archived by the owner on Sep 17, 2024. It is now read-only.

Commit 2a36f11

Browse files
authored
Merge branch 'master' into remove-volume-stand-alone
2 parents b39bd1a + d9e3b51 commit 2a36f11

7 files changed

Lines changed: 77 additions & 46 deletions

File tree

.ci/.package.yaml

Lines changed: 0 additions & 8 deletions
This file was deleted.

.ci/Jenkinsfile

Lines changed: 8 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -221,18 +221,17 @@ pipeline {
221221
deleteDir()
222222
unstash 'source'
223223
dir("${BASE_DIR}") {
224-
script {
225-
def matrix = readYaml(file: '.ci/.package.yaml')
226-
def parallelTasks = [:]
227-
matrix['OSS'].each { oss ->
228-
matrix['PLATFORM'].each { platform ->
229-
parallelTasks["${oss}-${platform}"] = generateStep(oss: "${oss}", platform: "${platform}")
230-
}
231-
}
232-
parallel(parallelTasks)
224+
setEnvVar("GITHUB_TOKEN", getGithubToken())
225+
retryWithSleep(retries: 2, seconds: 5, backoff: true) {
226+
sh(label: 'Release binaries with gorelease', script: 'curl -sL https://git.io/goreleaser | bash -s -- --rm-dist', returnStatus: true)
233227
}
234228
}
235229
}
230+
post {
231+
always {
232+
archiveArtifacts allowEmptyArchive: true, artifacts: "${BASE_DIR}/cli/dist/**"
233+
}
234+
}
236235
}
237236
}
238237
}
@@ -279,27 +278,6 @@ def doNotifyBuildResult(boolean slackNotify) {
279278
notifyBuildResult(analyzeFlakey: true, jobName: getFlakyJobName(withBranch: "${env.JOB_BASE_NAME}"), prComment: true, slackHeader: header, slackChannel: "${channels}", slackComment: true, slackNotify: slackNotify)
280279
}
281280

282-
283-
def generateStep(Map args = [:]){
284-
def oss = args.get('oss')
285-
def platform = args.get('platform')
286-
return {
287-
withNode(labels: 'ubuntu-18.04 && immutable && docker', sleepMax: 20, forceWorkspace: true){
288-
try {
289-
deleteDir()
290-
unstash 'source'
291-
dir("${BASE_DIR}/cli") {
292-
withEnv(["GOOS=${oss}", "GOARCH=${platform}"]) {
293-
sh script: 'make build', label: 'Create releases'
294-
}
295-
}
296-
} finally {
297-
archiveArtifacts allowEmptyArchive: true, artifacts: "${BASE_DIR}/cli/.github/releases/download/**"
298-
}
299-
}
300-
}
301-
}
302-
303281
def generateFunctionalTestStep(Map args = [:]){
304282
def platform = args.get('platform')
305283
def suite = args.get('suite')

.goreleaser.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,30 @@ changelog:
3535
exclude:
3636
- '^docs:'
3737
- '^test:'
38+
39+
# https://goreleaser.com/customization/release/
40+
release:
41+
# Repo in which the release will be created.
42+
# Default is extracted from the origin remote URL or empty if its private hosted.
43+
# Note: it can only be one: either github, gitlab or gitea
44+
github:
45+
owner: elastic
46+
name: e2e-testing
47+
48+
# If set to true, will not auto-publish the release.
49+
# Default is false.
50+
draft: true
51+
52+
# If set to auto, will mark the release as not ready for production
53+
# in case there is an indicator for this in the tag e.g. v1.0.0-rc1
54+
# If set to true, will mark the release as not ready for production.
55+
# Default is false.
56+
prerelease: auto
57+
58+
# You can change the name of the release.
59+
# Default is `{{.Tag}}`
60+
name_template: "{{.Tag}}"
61+
62+
# You can disable this pipe in order to not upload any artifacts.
63+
# Defaults to false.
64+
disable: false

cli/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ $ ./op run service mysql -v 5.7.12
1818
$ ./op run profile metricbeat
1919
```
2020

21+
To pass in multiple services at once:
22+
23+
```
24+
$ ./op run profile fleet -s elastic-agent:8.0.0-SNAPSHOT -s debian-systemd:latest
25+
```
26+
2127
The tool also provides a way to stop those running services:
2228
```sh
2329
# if you are in the Go development world
@@ -31,6 +37,12 @@ $ ./op stop service mysql -v 5.7.12
3137
$ ./op stop profile metricbeat
3238
```
3339

40+
Additionally, you can pass in environment options that will be passed along to the docker-compose configurations during deployment through use of the `-e` flag.
41+
42+
```
43+
$ ./op run profile fleet -s elastic-agent:8.0.0-SNAPSHOT -s debian-systemd:latest -e fleetServerMode=1 -e debian_systemdContainerName=test_container_1
44+
```
45+
3446
>By the way, `op` comes from `Observability Provisioner`.
3547
3648
## Configuring the CLI

cli/cmd/run.go

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ import (
1616
"github.com/spf13/cobra"
1717
)
1818

19-
var servicesToRun string
19+
var servicesToRun []string
2020
var versionToRun string
21+
var environmentItems map[string]string
2122

2223
func init() {
2324
config.Init()
@@ -38,12 +39,14 @@ func init() {
3839
profileSubcommand := buildRunProfileCommand(k, profile)
3940

4041
profileSubcommand.Flags().StringVarP(&versionToRun, "profileVersion", "v", "latest", "Sets the profile version to run")
41-
profileSubcommand.Flags().StringVarP(&servicesToRun, "withServices", "s", "", "Sets a list of comma-separated services to be depoyed alongside the profile")
42+
profileSubcommand.Flags().StringSliceVarP(&servicesToRun, "withServices", "s", nil, "List of services to deploy with profile, in the format of docker <image>:<tag>")
43+
profileSubcommand.Flags().StringToStringVarP(&environmentItems, "environment", "e", nil, "A list of environment key/value pairs to pass into deployment, in the format of ENV=VAR")
4244

4345
runProfileCmd.AddCommand(profileSubcommand)
4446
}
4547

4648
runCmd.AddCommand(runProfileCmd)
49+
4750
}
4851

4952
var runCmd = &cobra.Command{
@@ -65,6 +68,14 @@ func buildRunServiceCommand(srv string) *cobra.Command {
6568

6669
env := config.PutServiceEnvironment(map[string]string{}, srv, versionToRun)
6770

71+
for k, v := range environmentItems {
72+
log.WithFields(log.Fields{
73+
"env": k,
74+
"var": v,
75+
}).Trace("Adding key/value to environment")
76+
env[k] = v
77+
}
78+
6879
err := serviceManager.RunCompose(context.Background(), false, []string{srv}, env)
6980
if err != nil {
7081
log.WithFields(log.Fields{
@@ -91,6 +102,14 @@ Example:
91102
"profileVersion": versionToRun,
92103
}
93104

105+
for k, v := range environmentItems {
106+
log.WithFields(log.Fields{
107+
"env": k,
108+
"var": v,
109+
}).Trace("Adding key/value to environment")
110+
env[k] = v
111+
}
112+
94113
err := serviceManager.RunCompose(context.Background(), true, []string{key}, env)
95114
if err != nil {
96115
log.WithFields(log.Fields{
@@ -99,10 +118,8 @@ Example:
99118
}
100119

101120
composeNames := []string{}
102-
if servicesToRun != "" {
103-
services := strings.Split(servicesToRun, ",")
104-
105-
for _, srv := range services {
121+
if len(servicesToRun) > 0 {
122+
for _, srv := range servicesToRun {
106123
arr := strings.Split(srv, ":")
107124
if len(arr) != 2 {
108125
log.WithFields(log.Fields{
@@ -114,6 +131,11 @@ Example:
114131
image := arr[0]
115132
tag := arr[1]
116133

134+
log.WithFields(log.Fields{
135+
"image": image,
136+
"tag": tag,
137+
}).Trace("Adding service")
138+
117139
env = config.PutServiceEnvironment(env, image, tag)
118140
composeNames = append(composeNames, image)
119141
}

e2e/_suites/fleet/features/stand_alone_agent.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Examples: Ubi8
5454
@run_fleet_server
5555
Scenario Outline: Deploying a <image> stand-alone agent with fleet server mode
5656
When a "<image>" stand-alone agent is deployed with fleet server mode
57-
Then the agent is listed in Fleet as "online"
57+
Then the stand-alone agent is listed in Fleet as "online"
5858

5959
@default
6060
Examples: default

e2e/_suites/fleet/stand-alone.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func (sats *StandAloneTestSuite) contributeSteps(s *godog.ScenarioContext) {
5151
s.Step(`^there is new data in the index from agent$`, sats.thereIsNewDataInTheIndexFromAgent)
5252
s.Step(`^the "([^"]*)" docker container is stopped$`, sats.theDockerContainerIsStopped)
5353
s.Step(`^there is no new data in the index after agent shuts down$`, sats.thereIsNoNewDataInTheIndexAfterAgentShutsDown)
54-
s.Step(`^the agent is listed in Fleet as "([^"]*)"$`, sats.theAgentIsListedInFleetWithStatus)
54+
s.Step(`^the stand-alone agent is listed in Fleet as "([^"]*)"$`, sats.theAgentIsListedInFleetWithStatus)
5555
}
5656

5757
func (sats *StandAloneTestSuite) theAgentIsListedInFleetWithStatus(desiredStatus string) error {

0 commit comments

Comments
 (0)