diff --git a/_infra/ci/Dockerfile b/_infra/ci/Dockerfile index e030eaed54ae..5c654f6f7a24 100644 --- a/_infra/ci/Dockerfile +++ b/_infra/ci/Dockerfile @@ -24,4 +24,12 @@ ENV PATH="/usr/local/go/bin:$GOPATH/bin:$PATH" ENV GO=go # Delete forward-udp to enable statsd_receiver testing -RUN rm -f /usr/local/bin/forward-udp \ No newline at end of file +RUN rm -f /usr/local/bin/forward-udp + +# Install yq from artifactory +RUN curl -s0 https://artifactory.d.musta.ch/artifactory/generic-airbnb/yq/4.23.1/yq_linux_amd64 > /usr/local/bin/yq \ + && chmod a+x /usr/local/bin/yq + +# Install ssh-client to push to git \ +RUN apt-get update --yes \ + && apt-get install --yes ssh-client \ No newline at end of file diff --git a/_infra/ci/dispatch.yml b/_infra/ci/dispatch.yml index b7f9485056bc..37a17c354a9e 100644 --- a/_infra/ci/dispatch.yml +++ b/_infra/ci/dispatch.yml @@ -9,8 +9,15 @@ # the tag #continuous-integration. jobs: - - name: receiver/statsdreceiver CI Check + - name: CI Check for receiver/statsdreceiver path: _infra/ci/jobs/component_ci.yml options: + env: + COMPONENT_PATH: "receiver/statsdreceiver" + + - name: Tag repo for receiver/statsdreceiver + path: _infra/ci/jobs/tag_repo.yml + options: + only_run_if: "env('JORB_GIT_BRANCH') == 'airbnb'" env: COMPONENT_PATH: "receiver/statsdreceiver" \ No newline at end of file diff --git a/_infra/ci/jobs/tag_repo.yml b/_infra/ci/jobs/tag_repo.yml new file mode 100644 index 000000000000..ef5493bfa606 --- /dev/null +++ b/_infra/ci/jobs/tag_repo.yml @@ -0,0 +1,93 @@ +--- +# Generated by: onetouch-gen v1.26.3 (titanic: e28693593a57d500d94cdd97ceddff82c776522a) + +# This is a simple CI job. A CI job comprises a list of steps that run +# sequentially in a container described by an image or a Dockerfile. +# +# Questions? Visit air.bb/ci-docs or ask a question on Stack Overflow with +# the tag #continuous-integration. + +dockerfile: ../Dockerfile + +steps: + - type: run + label: set up ssh + env: + GHE_DEPLOY_KEY: "{% secret key=GHE_DEPLOY_KEY %}" + command: | + set -ex + + # Make .ssh directory + mkdir ~/.ssh + + # Put the deploy key on disk + SSH_KEY=/tmp/ghe-deploy-key + openssl enc -d -aes-256-cbc -in _infra/ci/secrets/id_rsa_otel.enc -out ${SSH_KEY} -pass pass:${GHE_DEPLOY_KEY} + chmod 600 $SSH_KEY + + # Set up the SSH configs + SSH_CONFIG=~/.ssh/config + cat < $SSH_CONFIG + Host git.musta.ch + IdentityFile $SSH_KEY + StrictHostKeyChecking no + ServerAliveInterval 10 + ServerAliveCountMax 10 + TCPKeepAlive yes + EOF + chmod 600 $SSH_CONFIG + + # Final check, and print the public key and config + git --version + ssh-keygen -y -f $SSH_KEY + cat $SSH_CONFIG + + - type: run + label: set up git repo + command: | + set -ex + + git_with_retries() { + MAX_ITERATIONS=${MAX_ITERATIONS:-6} + SUCCEEDED=0 + echo "Attempting to execute: git $* with $MAX_ITERATIONS retries" + for i in $(seq "$MAX_ITERATIONS"); do + # Try running the command. + if git "$@"; then + echo 'The command succeeded.' + SUCCEEDED=1 + break + fi + + # If we aren't in the last iteration, sleep and try again. + if [ "$i" -lt "$MAX_ITERATIONS" ]; then + SLEEP_DURATION="$((3 ** i))" + echo "The command failed. Waiting $SLEEP_DURATION seconds..." + sleep "$SLEEP_DURATION" + fi + done + + # Fail if the none of the attempts succeeded. + if [ "$SUCCEEDED" -eq 0 ]; then + echo 'The command never succeeded.' + false + fi + } + + echo "Update to master for release branch creation..." + git_with_retries clone "$JORB_DISPATCHER_GIT_DIR" /jorb/repo-copy-rw + cd /jorb/repo-copy-rw + git config --global user.email "buildkite@airbnb.com" + git config --global user.name "buildkite" + git rev-parse HEAD + git remote remove origin + git remote add origin git@git.musta.ch:third-party/opentelemetry-collector-contrib.git + + - type: run + label: Tag repo + command: | + cd /jorb/repo-copy-rw + + TAG=${COMPONENT_PATH}/$(yq '.module-sets.contrib-base.version' versions.yaml)-${JORB_GIT_BRANCH}-$(git rev-parse --short HEAD) + git tag $TAG + git push origin $TAG \ No newline at end of file diff --git a/_infra/ci/secrets/ci.a.json b/_infra/ci/secrets/ci.a.json new file mode 100644 index 000000000000..efc8bb968184 --- /dev/null +++ b/_infra/ci/secrets/ci.a.json @@ -0,0 +1,14 @@ +{ + "GHE_DEPLOY_KEY": { + "value": "ju6S06bULPkZElVlhEFtcDH/uQPcYV9WDcDj6g==", + "iv": "5lCpHHPZH5E0vSan", + "__keys__": { + "__shared__ci_secrets.production": { + "key": "NFroNnVruir2XerdDt2Xk5x8f8Zll0NpXIf4CWYk1B3lx2oed9n5Ddfo4YOWVluEKk/ru1Wpwo34alQEpe+ckxZVgGuFWdbENGYy1fdtfREIuM4KUfC+dlkCOlBayiVT4YoYWhfqpAwueZRNYMGtG1Dm+JZ9kk+wuQZGQt8+qXtcJXZMn06kZNked2oaR/ZzcWwZUKqgBDeV44BVkdsMnV+jlbSamiJ6RsyAdl+xHvZ0IKFA05WZGEAueoMgqeRwnfzlRzcoQo55aLJT9SKFnPPBgRE/4EEiRl3Hc0HdSWLLn54AWq0mGVyXjMR4vZJ0adlzOw2iCrNjs34gMYA8YQ==", + "sig": "90bff42516bebc2d2d3df04ff0a085b48676a2ccd1438394a0b9eef84b5d5d1c" + } + }, + "auth_tag": "1ajbH9mfszNRCVQx87khVQ==", + "annotations": "eyJ1cGRhdGVkX2F0IjoxNjU5NDAzNzAzLCJ1c2FnZV9jb250ZXh0Ijp7ImdpdF9yZXBvX3NsdWciOiJ0aGlyZC1wYXJ0eS9vcGVudGVsZW1ldHJ5LWNvbGxlY3Rvci1jb250cmliIn19" + } +} \ No newline at end of file diff --git a/_infra/ci/secrets/id_rsa_otel.enc b/_infra/ci/secrets/id_rsa_otel.enc new file mode 100644 index 000000000000..3fe357517907 Binary files /dev/null and b/_infra/ci/secrets/id_rsa_otel.enc differ