Skip to content

Instantly share code, notes, and snippets.

View v1v's full-sized avatar

Victor Martinez v1v

View GitHub Profile
@v1v
v1v / cmd-otelcontribcol-builder-config.yaml
Created March 21, 2024 09:20
cmd-otelcontribcol-builder-config.yaml
dist:
module: github.com/open-telemetry/opentelemetry-collector-contrib/cmd/otelcontribcol
name: otelcontribcol
description: Local OpenTelemetry Collector Contrib binary, testing only.
version: 0.90.0-dev
otelcol_version: 0.90.0
receivers:
- gomod: go.opentelemetry.io/collector/receiver/otlpreceiver v0.90.0
- gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver v0.90.0
@v1v
v1v / gist:187728021437e95ca3e8c8db9fccc479
Created March 12, 2024 15:32
gather the last 7 day workflow runs for the given GitHub org
#!/usr/bin/env python3
import logging
import os
from github import Auth, Github
def cli() -> None:
auth = Auth.Token(os.getenv("GITHUB_API_TOKEN"))
g = Github(auth=auth)
gh_repos = g.get_organization("your-repo").get_repos(sort="full_name", direction="asc")
command = "gh run list --jq ' .[]| select(.createdAt > (now-( 7 * 86400) | strftime(\"%Y-%m-%dT%H-%M-%SZ\") ))' --json conclusion,databaseId,createdAt,name --limit 1000"
@v1v
v1v / gist:8fff3c0010753cebf65d5861bbe3b0b8
Created September 5, 2023 16:07
git commands to update 4.x
➜ /tmp git clone git@github.com:elastic/apm-agent-nodejs.git
Cloning into 'apm-agent-nodejs'...
remote: Enumerating objects: 26088, done.
remote: Counting objects: 100% (4041/4041), done.
remote: Compressing objects: 100% (1602/1602), done.
remote: Total 26088 (delta 2681), reused 3548 (delta 2366), pack-reused 22047
Receiving objects: 100% (26088/26088), 14.83 MiB | 12.47 MiB/s, done.
Resolving deltas: 100% (18971/18971), done.
➜ /tmp git checkout main
➜ /tmp cd apm-agent-nodejs
@v1v
v1v / secret-analyzer.sh
Created May 16, 2023 20:20
Search for vault and github secrets in the given list of repositories
#!/usr/bin/env bash
# Uses gh and the given list of repositories
# then it clone each repository and search for all the Jenkinsfiles or GitHub actions
# which use Vault or GitHub secrets using some regex.
REPO_LIST=$1
# Set GH Token
GITHUB_TOKEN=$(gh auth token)
export GH_PAGER=""
@v1v
v1v / MacOS12 apm-agent-go
Created July 8, 2022 14:02
MacOS12 apm-agent-go
[2022-07-08T12:12:55.466Z] + ./scripts/jenkins/build.sh
[2022-07-08T12:12:55.476Z] + source ./scripts/jenkins/setenv.sh
[2022-07-08T12:12:55.476Z] ++ set -euxo pipefail
[2022-07-08T12:12:55.476Z] ++ echo 'Installing 1.15.10 with gimme.'
[2022-07-08T12:12:55.476Z] Installing 1.15.10 with gimme.
[2022-07-08T12:12:55.476Z] +++ GIMME_GO_VERSION=1.15.10
[2022-07-08T12:12:55.476Z] +++ bash
[2022-07-08T12:12:55.476Z] +++ curl -sL https://raw.githubusercontent.com/travis-ci/gimme/master/gimme
[2022-07-08T12:13:07.208Z] ++ eval '
[2022-07-08T12:13:07.208Z] unset GOOS;
@v1v
v1v / gist:6f052de55bb1b8c1c67cb5bb4dd04068
Created May 25, 2022 14:42
restart jenkins otel latest version
k logs jenkins-0 -c jenkins -f
Running from: /usr/share/jenkins/jenkins.war
webroot: EnvVars.masterEnvVars.get("JENKINS_HOME")
2022-05-25 14:41:20.718+0000 [id=1] INFO org.eclipse.jetty.util.log.Log#initialized: Logging initialized @494ms to org.eclipse.jetty.util.log.JavaUtilLog
2022-05-25 14:41:20.804+0000 [id=1] INFO winstone.Logger#logInternal: Beginning extraction from war file
2022-05-25 14:41:20.837+0000 [id=1] WARNING o.e.j.s.handler.ContextHandler#setContextPath: Empty contextPath
2022-05-25 14:41:20.918+0000 [id=1] INFO org.eclipse.jetty.server.Server#doStart: jetty-9.4.43.v20210629; built: 2021-06-30T11:07:22.254Z; git: 526006ecfa3af7f1a27ef3a288e2bef7ea9dd7e8; jvm 11.0.15+10
2022-05-25 14:41:21.238+0000 [id=1] INFO o.e.j.w.StandardDescriptorProcessor#visitServlet: NO JSP Support for /, did not find org.eclipse.jetty.jsp.JettyJspServlet
2022-05-25 14:41:21.292+0000 [id=1] INFO o.e.j.s.s.DefaultSessionIdManager#doStart: DefaultSessionIdManager workerName=node0
2022-05-25 14:41:21.293+0000 [id=1] INF
@v1v
v1v / gist:762e68b7433f7f5e79f0be1c0350730a
Created May 25, 2022 14:35
logs started jenkins with latest otel version
See the Jenkins pod
Running from: /usr/share/jenkins/jenkins.war
webroot: EnvVars.masterEnvVars.get("JENKINS_HOME")
2022-05-25 14:21:14.899+0000 [id=1] INFO org.eclipse.jetty.util.log.Log#initialized: Logging initialized @751ms to org.eclipse.jetty.util.log.JavaUtilLog
2022-05-25 14:21:14.992+0000 [id=1] INFO winstone.Logger#logInternal: Beginning extraction from war file
2022-05-25 14:21:15.029+0000 [id=1] WARNING o.e.j.s.handler.ContextHandler#setContextPath: Empty contextPath
2022-05-25 14:21:15.098+0000 [id=1] INFO org.eclipse.jetty.server.Server#doStart: jetty-9.4.43.v20210629; built: 2021-06-30T11:07:22.254Z; git: 526006ecfa3af7f1a27ef3a288e2bef7ea9dd7e8; jvm 11.0.15+10
2022-05-25 14:21:16.045+0000 [id=1] INFO o.e.j.w.StandardDescriptorProcessor#visitServlet: NO JSP Support for /, did not find org.eclipse.jetty.jsp.JettyJspServlet
2022-05-25 14:21:16.091+0000 [id=1] INFO o.e.j.s.s.DefaultSessionIdManager#doStart: DefaultSessionIdManager workerName=node0
2022-05-25 14:21:16.091+0000 [id=1] INFO o.e.j.s.s
@v1v
v1v / gist:134bff92aa320690d74c4ba75641cdf9
Created April 4, 2022 19:05
mage update build test - x-pack/auditbeat linux
mage update build test
Generated fields.yml for auditbeat to /var/lib/jenkins/workspace/Beats_beats_8.2/src/github.com/elastic/beats/x-pack/auditbeat/fields.yml
>> Building auditbeat.yml for linux/amd64
>> Building auditbeat.reference.yml for linux/amd64
>> Building auditbeat.docker.yml for linux/amd64
exec: go "list" "-m"
>> build: Building auditbeat
go: downloading github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
>> go test: Unit Testing
exec: gotestsum --no-color -f standard-quiet --junitfile build/TEST-go-unit.xml --jsonfile build/TEST-go-unit.out.json -- ./...
@v1v
v1v / gist:2578737e2481be75104501288bc70bcf
Created March 29, 2022 11:31
apm-server-package-mbp/detail/7.17/35
[2022-03-29T07:13:24.654Z] Warning: A secret was passed to "googleStorageDownload" using Groovy String interpolation, which is insecure.
[2022-03-29T07:13:24.655Z] Affected argument(s) used the following variable(s): [JOB_GCS_BUCKET]
[2022-03-29T07:13:24.655Z] See https://jenkins.io/redirect/groovy-string-interpolation for details.
[2022-03-29T07:13:24.732Z] [Google Cloud Storage Plugin] Found 61 files to download from pattern: gs://****/commits/0cb77d22d73af3614a4e3c579ae116fb4ea7fdda/*
[2022-03-29T07:13:27.743Z] [Google Cloud Storage Plugin] Downloading: jobs/commits/0cb77d22d73af3614a4e3c579ae116fb4ea7fdda/apm-server-7.17.2-SNAPSHOT-aarch64.rpm to local path: /var/lib/jenkins/workspace/rver_apm-server-package-mbp_7.17/src/github.com/elastic/apm-server/build/distributions/apm-server-7.17.2-SNAPSHOT-aarch64.rpm
[2022-03-29T07:13:28.712Z] [Google Cloud Storage Plugin] Downloading: jobs/commits/0cb77d22d73af3614a4e3c579ae116fb4ea7fdda/apm-server-7.17.2-SNAPSHOT-aarch64.rpm.sha512 to local path: /var/lib/
[2021-12-07T13:47:54.716Z] Started by user unknown or anonymous
[2021-12-07T13:47:54.716Z] Replayed #30
[2021-12-07T13:47:54.741Z] Loading library apm@current
[2021-12-07T13:47:54.742Z] FSSCM.checkout /var/pipeline-library to /var/jenkins_home/jobs/beats-mbp/branches/master/workspace@libs/apm
[2021-12-07T13:47:55.571Z] FSSCM.check completed in 829 milliseconds
[2021-12-07T13:47:58.626Z] [Pipeline] Start of Pipeline
[2021-12-07T13:47:59.003Z] [Pipeline] node
[2021-12-07T13:47:59.013Z] Running on orka-test-2 in /Users/admin/workspace/beats-mbp_master
[2021-12-07T13:47:59.031Z] [Pipeline] {
[2021-12-07T13:47:59.068Z] [Pipeline] withEnv