diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile deleted file mode 100644 index dec499f..0000000 --- a/.ci/Jenkinsfile +++ /dev/null @@ -1,89 +0,0 @@ -#!/usr/bin/env groovy - -@Library('apm@current') _ - -pipeline { - agent { label 'ubuntu-18 && immutable' } - environment { - REPO = "go-ucfg" - BASE_DIR = "src/github.com/elastic/${env.REPO}" - JOB_GIT_CREDENTIALS = "f6c7695a-671e-4f4f-a331-acdce44ff9ba" - PIPELINE_LOG_LEVEL = 'INFO' - } - options { - timeout(time: 1, unit: 'HOURS') - buildDiscarder(logRotator(numToKeepStr: '20', artifactNumToKeepStr: '20', daysToKeepStr: '30')) - timestamps() - ansiColor('xterm') - disableResume() - durabilityHint('PERFORMANCE_OPTIMIZED') - rateLimitBuilds(throttle: [count: 60, durationName: 'hour', userBoost: true]) - quietPeriod(10) - } - triggers { - issueCommentTrigger('(?i)(.*(?:jenkins\\W+)?run\\W+(?:the\\W+)?tests(?:\\W+please)?.*|^\\/test$)') - } - stages { - stage('Checkout') { - steps { - deleteDir() - gitCheckout(basedir: "${BASE_DIR}") - stash allowEmpty: true, name: 'source', useDefaultExcludes: false - } - } - stage('Check') { - options { skipDefaultCheckout() } - steps { - withGithubNotify(context: 'Check') { - deleteDir() - unstash 'source' - withGoEnv(version: '1.17', pkgs: ['github.com/elastic/go-licenser', 'go.elastic.co/go-licence-detector']){ - dir("${BASE_DIR}"){ - sh(label: '.ci/check.sh', script: '.ci/check.sh') - } - } - } - } - } - stage('Test') { - failFast false - matrix { - agent { label 'ubuntu-18 && immutable' } - options { skipDefaultCheckout() } - axes { - axis { - name 'GO_VERSION' - values '1.16', '1.17' - } - } - stages { - stage('Test') { - options { skipDefaultCheckout() } - steps { - withGithubNotify(context: "Test-${GO_VERSION}") { - deleteDir() - unstash 'source' - withGoEnv(version: "${GO_VERSION}"){ - dir("${BASE_DIR}"){ - sh(label: 'test', script: '.ci/test.sh') - } - } - } - } - post { - always { - archive "${BASE_DIR}/build/**" - junit(allowEmptyResults: true, keepLongStdio: true, testResults: "${BASE_DIR}/build/*xml") - } - } - } - } - } - } - } - post { - cleanup { - notifyBuildResult(prComment: true) - } - } -} diff --git a/.ci/check.sh b/.ci/check.sh index 4397353..d94a049 100755 --- a/.ci/check.sh +++ b/.ci/check.sh @@ -17,7 +17,9 @@ echo "Check format" checkformat go fmt ./... echo "Check for license headers" +go install github.com/elastic/go-licenser@latest checkformat go-licenser -license ASL2 echo "Check notice file" +go install go.elastic.co/go-licence-detector@latest checkformat dev-tools/generate_notice diff --git a/.ci/jobs/defaults.yml b/.ci/jobs/defaults.yml deleted file mode 100644 index d749f5b..0000000 --- a/.ci/jobs/defaults.yml +++ /dev/null @@ -1,18 +0,0 @@ ---- - -##### GLOBAL METADATA - -- meta: - cluster: beats-ci - -##### JOB DEFAULTS - -- job: - logrotate: - numToKeep: 20 - node: linux - concurrent: true - publishers: - - email: - recipients: infra-root+build@elastic.co - prune-dead-branches: true \ No newline at end of file diff --git a/.ci/jobs/folders.yml b/.ci/jobs/folders.yml deleted file mode 100644 index 7ec47c3..0000000 --- a/.ci/jobs/folders.yml +++ /dev/null @@ -1,10 +0,0 @@ ---- -#https://docs.openstack.org/infra/jenkins-job-builder/project_folder.html -- job: - name: Library - description: Library related Jobs - project-type: folder - -- view: - name: Library - view-type: list \ No newline at end of file diff --git a/.ci/jobs/go-ucfg-mbp.yml b/.ci/jobs/go-ucfg-mbp.yml deleted file mode 100644 index c728c9e..0000000 --- a/.ci/jobs/go-ucfg-mbp.yml +++ /dev/null @@ -1,42 +0,0 @@ ---- -- job: - name: Library/go-ucfg-mbp - display-name: Go Ucfg - description: Jenkins pipeline for the Go Ucfg project - view: Beats - project-type: multibranch - script-path: .ci/Jenkinsfile - scm: - - github: - branch-discovery: no-pr - discover-pr-forks-strategy: merge-current - discover-pr-forks-trust: permission - discover-pr-origin: merge-current - discover-tags: true - notification-context: 'beats-ci' - repo: go-ucfg - repo-owner: elastic - credentials-id: 2a9602aa-ab9f-4e52-baf3-b71ca88469c7-UserAndToken - ssh-checkout: - credentials: f6c7695a-671e-4f4f-a331-acdce44ff9ba - build-strategies: - - tags: - ignore-tags-older-than: -1 - ignore-tags-newer-than: -1 - - regular-branches: true - - change-request: - ignore-target-only-changes: false - clean: - after: true - before: true - prune: true - shallow-clone: true - depth: 5 - do-not-fetch-tags: true - submodule: - disable: false - recursive: true - parent-credentials: true - timeout: '15' - use-author: true - wipe-workspace: true diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..9e2b41d --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,58 @@ +--- + name: ci + + on: + workflow_dispatch: + push: + branches: + - main + pull_request: ~ + + permissions: + contents: read + + ## Concurrency only allowed in the main branch. + ## So old builds running for old commits within the same Pull Request are cancelled + concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + + jobs: + check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-go@v4 + with: + go-version: '1.17' + + - name: Check + run: .ci/check.sh + + test: + strategy: + fail-fast: false + matrix: + go-version: ['1.17', '1.18'] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-go@v4 + with: + go-version: ${{ matrix.go-version }} + cache: true + cache-dependency-path: '**/go.sum' + + - name: Test + run: .ci/test.sh + env: + GO_VERSION: ${{ matrix.go-version }} + + - name: Store test results + if: success() || failure() + uses: actions/upload-artifact@v3 + with: + name: test-results + path: build/junit*.xml diff --git a/.github/workflows/opentelemetry.yml b/.github/workflows/opentelemetry.yml new file mode 100644 index 0000000..237ab11 --- /dev/null +++ b/.github/workflows/opentelemetry.yml @@ -0,0 +1,19 @@ +--- + name: OpenTelemetry Export Trace + + on: + workflow_run: + workflows: + - ci + - test-reporter + types: [completed] + + jobs: + otel-export-trace: + runs-on: ubuntu-latest + steps: + - uses: elastic/apm-pipeline-library/.github/actions/opentelemetry@current + with: + vaultUrl: ${{ secrets.VAULT_ADDR }} + vaultRoleId: ${{ secrets.VAULT_ROLE_ID }} + vaultSecretId: ${{ secrets.VAULT_SECRET_ID }} diff --git a/.github/workflows/test-reporter.yml b/.github/workflows/test-reporter.yml new file mode 100644 index 0000000..39b10a0 --- /dev/null +++ b/.github/workflows/test-reporter.yml @@ -0,0 +1,20 @@ +--- +## Workflow to process the JUnit test results and add a report to the checks. +name: test-reporter +on: + workflow_run: + workflows: + - test + types: + - completed + +jobs: + report: + runs-on: ubuntu-latest + steps: + - uses: elastic/apm-pipeline-library/.github/actions/test-report@current + with: + artifact: test-results # artifact name + name: JUnit Tests # Name of the check run which will be created + path: "**/*.xml" # Path to test results (inside artifact .zip) + reporter: java-junit # Format of test results diff --git a/NOTICE.txt b/NOTICE.txt index 5dde3ce..05c57a7 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -1,4 +1,4 @@ -Copyright 2016-2022 Elasticsearch BV +Copyright 2016-2023 Elasticsearch BV This product includes software developed by The Apache Software Foundation (http://www.apache.org/). diff --git a/README.md b/README.md index 2a2482d..8f7fb50 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Build Status](https://beats-ci.elastic.co/job/Library/job/go-ucfg-mbp/job/main/badge/icon)](https://beats-ci.elastic.co/job/Library/job/go-ucfg-mbp/job/main/) +[![ci](https://github.com/elastic/go-ucfg/actions/workflows/ci.yml/badge.svg)](https://github.com/elastic/go-ucfg/actions/workflows/ci.yml) [![Go Report Card](https://goreportcard.com/badge/github.com/elastic/go-ucfg)](https://goreportcard.com/report/github.com/elastic/go-ucfg) [![codecov](https://codecov.io/gh/elastic/go-ucfg/branch/main/graph/badge.svg)](https://codecov.io/gh/elastic/go-ucfg)