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

Commit

Permalink
chore: update backports to 7.x (#1077)
Browse files Browse the repository at this point in the history
* cli: enable loading default profiles turnkey (#943)

* cli: enable loading default profiles turnkey

Fixes #933
* update NOTICE
* Fix additional lint issues in ingest_manager_test
* Cleanup comment and trace log in GetComposeFile
* Provide better trace feedback if missing docker-compose
* Update cli/config/config.go
* chore: add back traces when extracting the files from the box (#946)
* fix: use a more comprehensive initialisation method for configs
   As go init() method is not deterministic, I found that the logger init was
   not called at the right time. With change we ensure that the Init is:
   1) called first
   2) existing it the config was already populated
* chore: add back traces when extracting the files from the box

Signed-off-by: Adam Stokes <51892+adam-stokes@users.noreply.github.com>
Co-authored-by: Manuel de la Peña <mdelapenya@gmail.com>

* Add basic check on correct service is defined for profile runs (#957)

Fixes #944

This adds a length check on the string split for verifying that the
<service/image name>:<tag> is defined when adding additional services to a
profile deployment.

Signed-off-by: Adam Stokes <51892+adam-stokes@users.noreply.github.com>

* Update NOTICE (#969)

Adds additional overrides to pulling in the proper licenses

Signed-off-by: Adam Stokes <51892+adam-stokes@users.noreply.github.com>

* Build binaries via goreleaser (#977)

This handles building for all supported architectures including running packr
for embedding the binary files.

This allows us to easily extend our release process for tagging official cli
releases, building in various package formats and publishing to different
package registries

Signed-off-by: Adam Stokes <51892+adam-stokes@users.noreply.github.com>

* chore: simplify release process on Jenkins (#980)

* chore: archive releases in Jenkins UI

* chore: simplify release process on Jenkins

* chore: remove garbage

* chore: support retrying fetching the goreleaser script

It will also retry in the case the release command fails

* chore: set GITHUB_TOKEN

* chore: ensure workspace is clean in the worker

* chore: add release information for goreleaser

* Remove the agent config file parameters for stand alone (#983)

Signed-off-by: Adam Stokes <51892+adam-stokes@users.noreply.github.com>

Co-authored-by: Manuel de la Peña <mdelapenya@gmail.com>

* fix: run unit tests after refactor (#1067)

* chore: remove unused files after refactor

* chore: run unit tests with new layout

* fix: run unit tests on CI

* chore: include unit tests for the e2e dir

* fix: move unit tests resources for installer tests

* fix: move more test resources for unit tests

* fix: abstract path calculation from OS

Co-authored-by: Adam Stokes <51892+adam-stokes@users.noreply.github.com>
  • Loading branch information
mdelapenya and adam-stokes authored Apr 22, 2021
1 parent 4cd5b44 commit 1291c19
Show file tree
Hide file tree
Showing 45 changed files with 160,146 additions and 24,288 deletions.
8 changes: 0 additions & 8 deletions .ci/.package.yaml

This file was deleted.

38 changes: 8 additions & 30 deletions .ci/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -223,18 +223,17 @@ pipeline {
deleteDir()
unstash 'source'
dir("${BASE_DIR}") {
script {
def matrix = readYaml(file: '.ci/.package.yaml')
def parallelTasks = [:]
matrix['OSS'].each { oss ->
matrix['PLATFORM'].each { platform ->
parallelTasks["${oss}-${platform}"] = generateStep(oss: "${oss}", platform: "${platform}")
}
}
parallel(parallelTasks)
setEnvVar("GITHUB_TOKEN", getGithubToken())
retryWithSleep(retries: 2, seconds: 5, backoff: true) {
sh(label: 'Release binaries with gorelease', script: 'curl -sL https://git.io/goreleaser | bash -s -- --rm-dist', returnStatus: true)
}
}
}
post {
always {
archiveArtifacts allowEmptyArchive: true, artifacts: "${BASE_DIR}/cli/dist/**"
}
}
}
}
}
Expand Down Expand Up @@ -281,27 +280,6 @@ def doNotifyBuildResult(boolean slackNotify) {
notifyBuildResult(analyzeFlakey: true, jobName: getFlakyJobName(withBranch: "${env.JOB_BASE_NAME}"), prComment: true, slackHeader: header, slackChannel: "${channels}", slackComment: true, slackNotify: slackNotify)
}


def generateStep(Map args = [:]){
def oss = args.get('oss')
def platform = args.get('platform')
return {
withNode(labels: 'ubuntu-18.04 && immutable && docker', sleepMax: 20, forceWorkspace: true){
try {
deleteDir()
unstash 'source'
dir("${BASE_DIR}/cli") {
withEnv(["GOOS=${oss}", "GOARCH=${platform}"]) {
sh script: 'make build', label: 'Create releases'
}
}
} finally {
archiveArtifacts allowEmptyArchive: true, artifacts: "${BASE_DIR}/cli/.github/releases/download/**"
}
}
}
}

def generateFunctionalTestStep(Map args = [:]){
def platform = args.get('platform')
def suite = args.get('suite')
Expand Down
3 changes: 1 addition & 2 deletions .ci/scripts/build-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,4 @@ mkdir -p $(pwd)/outputs

go get -v -u gotest.tools/gotestsum

make -C cli install test
make -C e2e unit-test
make unit-test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
bin
outputs
dist/
64 changes: 64 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# This is an example .goreleaser.yml file with some sane defaults.
# Make sure to check the documentation at http://goreleaser.com
env:
- GO111MODULE=on

before:
hooks:
- go mod download
- go install github.com/gobuffalo/packr/v2/packr2
- cd cli && packr2

builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
main: ./cli/main.go
binary: op
archives:
- replacements:
darwin: Darwin
linux: Linux
windows: Windows
386: i386
amd64: x86_64
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ .Tag }}-next"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'

# https://goreleaser.com/customization/release/
release:
# Repo in which the release will be created.
# Default is extracted from the origin remote URL or empty if its private hosted.
# Note: it can only be one: either github, gitlab or gitea
github:
owner: elastic
name: e2e-testing

# If set to true, will not auto-publish the release.
# Default is false.
draft: true

# If set to auto, will mark the release as not ready for production
# in case there is an indicator for this in the tag e.g. v1.0.0-rc1
# If set to true, will mark the release as not ready for production.
# Default is false.
prerelease: auto

# You can change the name of the release.
# Default is `{{.Tag}}`
name_template: "{{.Tag}}"

# You can disable this pipe in order to not upload any artifacts.
# Defaults to false.
disable: false
31 changes: 31 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# Get current directory of a Makefile: https://stackoverflow.com/a/23324703

include ./commons.mk

# Builds cli for all supported platforms
.PHONY: build
build:
goreleaser --snapshot --skip-publish --rm-dist

.PHONY: clean
clean: clean-workspace clean-docker

Expand All @@ -12,3 +21,25 @@ clean-workspace:
.PHONY: install
install:
go get -v -t ./...

.PHONY: notice
notice:
@echo "Generating NOTICE"
# TODO: Re-enable once new version of go-apm-agent is out
# go mod tidy
go mod download
go list -m -json all | go run go.elastic.co/go-licence-detector \
-includeIndirect \
-rules ./notice/rules.json \
-overrides ./notice/overrides.json \
-noticeTemplate ./notice/NOTICE.txt.tmpl \
-noticeOut NOTICE.txt \
-depsOut ""

.PHONY: unit-test
unit-test: test-report-setup unit-test-dir-cli unit-test-dir-internal unit-test-dir-e2e

# See https://pkg.go.dev/gotest.tools/gotestsum/#readme-junit-xml-output
.PHONY: unit-test-suite-%
unit-test-dir-%:
cd $* && gotestsum --junitfile "$(PWD)/outputs/TEST-unit-$*.xml" --format testname -- -count=1 -timeout=$(TEST_TIMEOUT) ./...
Loading

0 comments on commit 1291c19

Please sign in to comment.