Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into feature/retry-win…
Browse files Browse the repository at this point in the history
…dows-7

* upstream/master:
  Remove OSS reference for kibana and elasticsearch (elastic#24164)
  Skip flaky TestActions on MacOSx (elastic#23966)
  [Filebeat][AWS] Fix vpcflow pipeline exception: Cannot invoke "Object.getClass()" because "receiver" is null (elastic#24167)
  [Elastic Agent] Fix docker entrypoint for elastic-agent. (elastic#24155)
  [PACKAGING] Push docker images with the architecture in the version (elastic#24121)
  [Agent] Add agent standalone manifests for system module & Pod's log collection (elastic#23938)
  indicator type url is in upper case (elastic#24152)
  [Filebeat] Document netflow internal_networks and set default (elastic#24110)
  [Filebeat] Adding fixes to the TI module (elastic#24133)
  [Enhancement] Add RotateOnStartup feature flag for file output (elastic#19347)
  [Ingest Manager] Fix: Successfully installed and enrolled agent running standalone (elastic#24128)
  Set Elastic licence type for APM server Beats update job (elastic#24122)
  Add logrotation section on Running Filebeat on k8s (elastic#24120)
  [CI] Run if manual UI (elastic#24116)
  [CI] enable x-pack/heartbeat in the CI (elastic#23873)
  chore: comment out the E2E (elastic#24109)
  chore: add-backport-next (elastic#24098)
  Adjust the position of the architecture name in Dockerlogbeat tarball (elastic#24095)
  Update dependencies for M1 support in System (elastic#24019)
  • Loading branch information
v1v committed Feb 23, 2021
2 parents 446f840 + b8ed7f5 commit 3ea53ee
Show file tree
Hide file tree
Showing 72 changed files with 1,546 additions and 435 deletions.
2 changes: 1 addition & 1 deletion .backportrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"upstream": "elastic/beats",
"branches": [ { "name": "7.x", "checked": true }, "7.11" ],
"branches": [ { "name": "7.x", "checked": true }, "7.12", "7.11" ],
"labels": ["backport"],
"autoAssign": true,
"prTitle": "Cherry-pick to {targetBranch}: {commitMessages}"
Expand Down
4 changes: 2 additions & 2 deletions .ci/apm-beats-update.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,9 @@ pipeline {
branch "v\\d?"
tag "v\\d+\\.\\d+\\.\\d+*"
allOf {
expression { return env.BEATS_UPDATED != "false" || isCommentTrigger() }
expression { return env.BEATS_UPDATED != "false" || isCommentTrigger() || isUserTrigger() }
changeRequest()
}

}
}
steps {
Expand Down Expand Up @@ -127,6 +126,7 @@ def beatsUpdate() {
git config --global --add remote.origin.fetch "+refs/pull/*/head:refs/remotes/origin/pr/*"
go mod edit -replace github.com/elastic/beats/v7=\${GOPATH}/src/github.com/elastic/beats-local
echo '{"name": "${GOPATH}/src/github.com/elastic/beats-local", "licenceType": "Elastic"}' >> \${GOPATH}/src/github.com/elastic/beats-local/dev-tools/notice/overrides.json
make update
git commit -a -m beats-update
Expand Down
69 changes: 46 additions & 23 deletions .ci/packaging.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,9 @@ pipeline {
withGithubNotify(context: "Packaging Linux ${BEATS_FOLDER}") {
deleteDir()
release()
pushCIDockerImages()
dir("${BASE_DIR}"){
pushCIDockerImages(arch: 'amd64')
}
}
prepareE2ETestForPackage("${BEATS_FOLDER}")
}
Expand Down Expand Up @@ -234,7 +236,9 @@ pipeline {
withGithubNotify(context: "Packaging linux/arm64 ${BEATS_FOLDER}") {
deleteWorkspace()
release()
pushCIDockerImages()
dir("${BASE_DIR}"){
pushCIDockerImages(arch: 'arm64')
}
}
}
post {
Expand Down Expand Up @@ -270,27 +274,37 @@ pipeline {
}
}

def pushCIDockerImages(){
/**
* @param arch what architecture
*/
def pushCIDockerImages(Map args = [:]) {
def arch = args.get('arch', 'amd64')
catchError(buildResult: 'UNSTABLE', message: 'Unable to push Docker images', stageResult: 'FAILURE') {
if (env?.BEATS_FOLDER?.endsWith('auditbeat')) {
tagAndPush('auditbeat')
tagAndPush(beatName: 'auditbeat', arch: arch)
} else if (env?.BEATS_FOLDER?.endsWith('filebeat')) {
tagAndPush('filebeat')
tagAndPush(beatName: 'filebeat', arch: arch)
} else if (env?.BEATS_FOLDER?.endsWith('heartbeat')) {
tagAndPush('heartbeat')
tagAndPush(beatName: 'heartbeat', arch: arch)
} else if ("${env.BEATS_FOLDER}" == "journalbeat"){
tagAndPush('journalbeat')
tagAndPush(beatName: 'journalbeat', arch: arch)
} else if (env?.BEATS_FOLDER?.endsWith('metricbeat')) {
tagAndPush('metricbeat')
tagAndPush(beatName: 'metricbeat', arch: arch)
} else if ("${env.BEATS_FOLDER}" == "packetbeat"){
tagAndPush('packetbeat')
tagAndPush(beatName: 'packetbeat', arch: arch)
} else if ("${env.BEATS_FOLDER}" == "x-pack/elastic-agent") {
tagAndPush('elastic-agent')
tagAndPush(beatName: 'elastic-agent', arch: arch)
}
}
}

def tagAndPush(beatName){
/**
* @param beatName name of the Beat
* @param arch what architecture
*/
def tagAndPush(Map args = [:]) {
def beatName = args.beatName
def arch = args.get('arch', 'amd64')
def libbetaVer = env.BEAT_VERSION
def aliasVersion = ""
if("${env.SNAPSHOT}" == "true"){
Expand All @@ -307,14 +321,22 @@ def tagAndPush(beatName){

dockerLogin(secret: "${DOCKERELASTIC_SECRET}", registry: "${DOCKER_REGISTRY}")

// supported tags
def tags = [tagName, "${env.GIT_BASE_COMMIT}"]
if (!isPR() && aliasVersion != "") {
tags << aliasVersion
}
// supported image flavours
def variants = ["", "-oss", "-ubi8"]
variants.each { variant ->
doTagAndPush(beatName, variant, libbetaVer, tagName)
doTagAndPush(beatName, variant, libbetaVer, "${env.GIT_BASE_COMMIT}")

if (!isPR() && aliasVersion != "") {
doTagAndPush(beatName, variant, libbetaVer, aliasVersion)
tags.each { tag ->
// TODO:
// For backward compatibility let's ensure we tag only for amd64, then E2E can benefit from until
// they support the versioning with the architecture
if ("${arch}" == "amd64") {
doTagAndPush(beatName: beatName, variant: variant, sourceTag: libbetaVer, targetTag: "${tag}")
}
doTagAndPush(beatName: beatName, variant: variant, sourceTag: libbetaVer, targetTag: "${tag}-${arch}")
}
}
}
Expand All @@ -325,18 +347,19 @@ def tagAndPush(beatName){
* @param sourceTag tag to be used as source for the docker tag command, usually under the 'beats' namespace
* @param targetTag tag to be used as target for the docker tag command, usually under the 'observability-ci' namespace
*/
def doTagAndPush(beatName, variant, sourceTag, targetTag) {
def doTagAndPush(Map args = [:]) {
def beatName = args.beatName
def variant = args.variant
def sourceTag = args.sourceTag
def targetTag = args.targetTag
def sourceName = "${DOCKER_REGISTRY}/beats/${beatName}${variant}:${sourceTag}"
def targetName = "${DOCKER_REGISTRY}/observability-ci/${beatName}${variant}:${targetTag}"

def iterations = 0
retryWithSleep(retries: 3, seconds: 5, backoff: true) {
iterations++
def status = sh(label: "Change tag and push ${targetName}", script: """
docker tag ${sourceName} ${targetName}
docker push ${targetName}
""", returnStatus: true)

def status = sh(label: "Change tag and push ${targetName}",
script: ".ci/scripts/docker-tag-push.sh ${sourceName} ${targetName}",
returnStatus: true)
if ( status > 0 && iterations < 3) {
error("tag and push failed for ${beatName}, retry")
} else if ( status > 0 ) {
Expand Down
12 changes: 12 additions & 0 deletions .ci/scripts/docker-tag-push.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
set -exuo pipefail
MSG="parameter missing."
SOURCE_IMAGE=${1:?$MSG}
TARGET_IMAGE=${2:?$MSG}

if docker image inspect "${SOURCE_IMAGE}" &> /dev/null ; then
docker tag "${SOURCE_IMAGE}" "${TARGET_IMAGE}"
docker push "${TARGET_IMAGE}"
else
echo "docker image ${SOURCE_IMAGE} does not exist"
fi
4 changes: 4 additions & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,8 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Fix Logstash module handling of logstash.log.log_event.action field. {issue}20709[20709]
- aws/s3access dataset was populating event.duration using the wrong unit. {pull}23920[23920]
- Zoom module pipeline failed to ingest some chat_channel events. {pull}23904[23904]
- Fix Netflow module issue with missing `internal_networks` config parameter. {issue}24094[24094] {pull}24110[24110]
- Fix aws/vpcflow generating errors for empty logs or unidentified formats. {pull}24167[24167]

*Heartbeat*

Expand Down Expand Up @@ -572,6 +574,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Add keystore support for autodiscover static configurations. {pull]16306[16306]
- Add TLS support to Kerberos authentication in Elasticsearch. {pull}18607[18607]
- Add support for multiple sets of hints on autodiscover {pull}18883[18883]
- Add config option `rotate_on_startup` to file output {issue}19150[19150] {pull}19347[19347]
- Add a configurable delay between retries when an app metadata cannot be retrieved by `add_cloudfoundry_metadata`. {pull}19181[19181]
- Added the `max_cached_sessions` option to the script processor. {pull}19562[19562]
- Add support for DNS over TLS for the dns_processor. {pull}19321[19321]
Expand Down Expand Up @@ -996,6 +999,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Apache: convert status.total_kbytes to status.total_bytes in fleet mode. {pull}23022[23022]
- Release MSSQL as GA {pull}23146[23146]
- Enrich events of `state_service` metricset with kubernetes services' metadata. {pull}23730[23730]
- Add support for Darwin/arm M1. {pull}24019[24019]
- Check fields are documented in aws metricsets. {pull}23887[23887]

*Packetbeat*
Expand Down
67 changes: 40 additions & 27 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -328,23 +328,26 @@ def uploadPackages(bucketUri, beatsFolder){
/**
* Push the docker images for the given beat.
* @param beatsFolder beats folder
* @param arch what architecture
*/
def pushCIDockerImages(beatsFolder){
def pushCIDockerImages(Map args = [:]) {
def arch = args.get('arch', 'amd64')
def beatsFolder = args.beatsFolder
catchError(buildResult: 'UNSTABLE', message: 'Unable to push Docker images', stageResult: 'FAILURE') {
if (beatsFolder.endsWith('auditbeat')) {
tagAndPush('auditbeat')
tagAndPush(beatName: 'auditbeat', arch: arch)
} else if (beatsFolder.endsWith('filebeat')) {
tagAndPush('filebeat')
tagAndPush(beatName: 'filebeat', arch: arch)
} else if (beatsFolder.endsWith('heartbeat')) {
tagAndPush('heartbeat')
tagAndPush(beatName: 'heartbeat', arch: arch)
} else if ("${beatsFolder}" == "journalbeat"){
tagAndPush('journalbeat')
tagAndPush(beatName: 'journalbeat', arch: arch)
} else if (beatsFolder.endsWith('metricbeat')) {
tagAndPush('metricbeat')
tagAndPush(beatName: 'metricbeat', arch: arch)
} else if ("${beatsFolder}" == "packetbeat"){
tagAndPush('packetbeat')
tagAndPush(beatName: 'packetbeat', arch: arch)
} else if ("${beatsFolder}" == "x-pack/elastic-agent") {
tagAndPush('elastic-agent')
tagAndPush(beatName: 'elastic-agent', arch: arch)
}
}
}
Expand All @@ -353,7 +356,9 @@ def pushCIDockerImages(beatsFolder){
* Tag and push all the docker images for the given beat.
* @param beatName name of the Beat
*/
def tagAndPush(beatName){
def tagAndPush(Map args = [:]) {
def beatName = args.beatName
def arch = args.get('arch', 'amd64')
def libbetaVer = env.VERSION
if("${env?.SNAPSHOT.trim()}" == "true"){
aliasVersion = libbetaVer.substring(0, libbetaVer.lastIndexOf(".")) // remove third number in version
Expand All @@ -367,41 +372,40 @@ def tagAndPush(beatName){
tagName = "pr-${env.CHANGE_ID}"
}

// supported tags
def tags = [tagName, "${env.GIT_BASE_COMMIT}"]
if (!isPR() && aliasVersion != "") {
tags << aliasVersion
}
// supported image flavours
def variants = ["", "-oss", "-ubi8"]
variants.each { variant ->
doTagAndPush(beatName, variant, libbetaVer, tagName)
doTagAndPush(beatName, variant, libbetaVer, "${env.GIT_BASE_COMMIT}")

if (!isPR() && aliasVersion != "") {
doTagAndPush(beatName, variant, libbetaVer, aliasVersion)
tags.each { tag ->
doTagAndPush(beatName: beatName, variant: variant, sourceTag: libbetaVer, targetTag: "${tag}-${arch}")
}
}
}

/**
* Tag and push the given sourceTag docker image with the tag name targetTag.
* @param beatName name of the Beat
* @param variant name of the variant used to build the docker image name
* @param sourceTag tag to be used as source for the docker tag command, usually under the 'beats' namespace
* @param targetTag tag to be used as target for the docker tag command, usually under the 'observability-ci' namespace
*/
def doTagAndPush(beatName, variant, sourceTag, targetTag) {
def doTagAndPush(Map args = [:]) {
def beatName = args.beatName
def variant = args.variant
def sourceTag = args.sourceTag
def targetTag = args.targetTag
def sourceName = "${DOCKER_REGISTRY}/beats/${beatName}${variant}:${sourceTag}"
def targetName = "${DOCKER_REGISTRY}/observability-ci/${beatName}${variant}:${targetTag}"

def iterations = 0
retryWithSleep(retries: 3, seconds: 5, backoff: true) {
iterations++
def status = sh(label: "Change tag and push ${targetName}", script: """#!/usr/bin/env bash
docker images
if docker image inspect "${sourceName}" &> /dev/null ; then
docker tag ${sourceName} ${targetName}
docker push ${targetName}
else
echo 'docker image ${sourceName} does not exist'
fi
""", returnStatus: true)
def status = sh(label: "Change tag and push ${targetName}",
script: ".ci/scripts/docker-tag-push.sh ${sourceName} ${targetName}",
returnStatus: true)
if ( status > 0 && iterations < 3) {
error("tag and push failed for ${beatName}, retry")
} else if ( status > 0 ) {
Expand Down Expand Up @@ -488,6 +492,7 @@ def runCommand(Map args = [:]) {
def isMage = args.get('isMage', false)
def isE2E = args.e2e?.get('enabled', false)
def isPackaging = args.get('package', false)
def dockerArch = args.get('dockerArch', 'amd64')
withNode(args.label) {
withGithubNotify(context: "${context}") {
withBeatsEnv(archive: true, withModule: withModule, directory: directory, id: args.id) {
Expand All @@ -508,7 +513,7 @@ def runCommand(Map args = [:]) {
// TODO:
// push docker images should happen only after the e2e?
if (isPackaging) {
pushCIDockerImages("${directory}")
pushCIDockerImages(beatsFolder: "${directory}", arch: dockerArch)
}
}
}
Expand Down Expand Up @@ -961,7 +966,15 @@ class RunCommand extends co.elastic.beats.BeatsFunction {
steps.target(context: args.context, command: args.content.mage, directory: args.project, label: args.label, withModule: withModule, isMage: true, id: args.id)
}
if(args?.content?.containsKey('packaging-linux')) {
steps.packagingLinux(context: args.context, command: args.content.get('packaging-linux'), directory: args.project, label: args.label, isMage: true, id: args.id, e2e: args.content.get('e2e'), package: true)
steps.packagingLinux(context: args.context,
command: args.content.get('packaging-linux'),
directory: args.project,
label: args.label,
isMage: true,
id: args.id,
e2e: args.content.get('e2e'),
package: true,
dockerArch: 'amd64')
}
if(args?.content?.containsKey('k8sTest')) {
steps.k8sTest(context: args.context, versions: args.content.k8sTest.split(','), label: args.label, id: args.id)
Expand Down
8 changes: 4 additions & 4 deletions NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7665,11 +7665,11 @@ Contents of probable licence file $GOMODCACHE/github.com/elastic/go-structform@v

--------------------------------------------------------------------------------
Dependency : github.com/elastic/go-sysinfo
Version: v1.5.0
Version: v1.6.0
Licence type (autodetected): Apache-2.0
--------------------------------------------------------------------------------

Contents of probable licence file $GOMODCACHE/github.com/elastic/go-sysinfo@v1.5.0/LICENSE.txt:
Contents of probable licence file $GOMODCACHE/github.com/elastic/go-sysinfo@v1.6.0/LICENSE.txt:


Apache License
Expand Down Expand Up @@ -8299,11 +8299,11 @@ Contents of probable licence file $GOMODCACHE/github.com/elastic/go-ucfg@v0.8.3/

--------------------------------------------------------------------------------
Dependency : github.com/elastic/gosigar
Version: v0.13.0
Version: v0.14.0
Licence type (autodetected): Apache-2.0
--------------------------------------------------------------------------------

Contents of probable licence file $GOMODCACHE/github.com/elastic/gosigar@v0.13.0/LICENSE:
Contents of probable licence file $GOMODCACHE/github.com/elastic/gosigar@v0.14.0/LICENSE:

Apache License
Version 2.0, January 2004
Expand Down
4 changes: 3 additions & 1 deletion auditbeat/auditbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1103,7 +1103,9 @@ output.elasticsearch:

# Permissions to use for file creation. The default is 0600.
#permissions: 0600


# Configure automatic file rotation on every startup. The default is true.
#rotate_on_startup: true
# ------------------------------- Console Output -------------------------------
#output.console:
# Boolean flag to enable or disable the output module.
Expand Down
10 changes: 2 additions & 8 deletions auditbeat/module/file_integrity/metricset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,6 @@ func TestData(t *testing.T) {
func TestActions(t *testing.T) {
defer abtest.SetupDataDir(t)()

if runtime.GOOS == "windows" {
t.Skip("Skipping flaky test: https://github.com/elastic/beats/issues/22518")
}

bucket, err := datastore.OpenBucket(bucketName)
if err != nil {
t.Fatal(err)
Expand Down Expand Up @@ -138,10 +134,8 @@ func TestActions(t *testing.T) {
}

// Create some files in first directory
go func() {
ioutil.WriteFile(createdFilepath, []byte("hello world"), 0600)
ioutil.WriteFile(updatedFilepath, []byte("hello world"), 0600)
}()
ioutil.WriteFile(createdFilepath, []byte("hello world"), 0600)
ioutil.WriteFile(updatedFilepath, []byte("hello world"), 0600)

ms := mbtest.NewPushMetricSetV2(t, getConfig(dir, newDir))
events := mbtest.RunPushMetricSetV2(10*time.Second, 5, ms)
Expand Down
Loading

0 comments on commit 3ea53ee

Please sign in to comment.