Skip to content

Commit

Permalink
Use util method for safeName in build finished hook
Browse files Browse the repository at this point in the history
  • Loading branch information
breskeby committed Nov 15, 2024
1 parent 3201815 commit 8220e1a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import java.time.LocalDateTime;

import org.elasticsearch.gradle.Architecture
import org.elasticsearch.gradle.OS
import static org.elasticsearch.gradle.internal.util.CiUtils.safeName

import java.lang.management.ManagementFactory
import java.time.LocalDateTime
Expand Down Expand Up @@ -46,7 +47,6 @@ develocity {
}

if (onCI) { //Buildkite-specific build scan metadata
def safeName = { String s -> s.replaceAll(/[^a-zA-Z0-9_\-\.]+/, ' ').trim().replaceAll(' ', '_') }
String buildKiteUrl = System.getenv('BUILDKITE_BUILD_URL')
def branch = System.getenv('BUILDKITE_PULL_REQUEST_BASE_BRANCH') ?: System.getenv('BUILDKITE_BRANCH')
def repoMatcher = System.getenv('BUILDKITE_REPO') =~ /(https:\/\/github\.com\/|git@github\.com:)(\S+)\.git/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* 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", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/

package org.elasticsearch.gradle.internal.util;

public class CiUtils {

static String safeName(String input) {
return input.replaceAll("[^a-zA-Z0-9_\\-\\.]+", " ").trim().replaceAll(" ", "_").toLowerCase();
}

}

0 comments on commit 8220e1a

Please sign in to comment.