Skip to content
This repository was archived by the owner on Sep 17, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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