diff --git a/.buildkite/annotate.yml b/.buildkite/annotate.yml new file mode 100644 index 00000000..f85caa16 --- /dev/null +++ b/.buildkite/annotate.yml @@ -0,0 +1,10 @@ + - label: annotate + plugins: + - bugcrowd/test-summary#v1.8.0: + inputs: + - label: rspec + artifact_path: artifacts/rspec* + type: junit + formatter: + type: details + context: test-summary diff --git a/.buildkite/artifact.yml b/.buildkite/artifact.yml new file mode 100644 index 00000000..daa26a3d --- /dev/null +++ b/.buildkite/artifact.yml @@ -0,0 +1,8 @@ +steps: + - label: Upload + key: step1 + command: buildkite-agent artifact upload "./upload.txt" + + - label: Download + depends_on: step1 + command: buildkite-agent artifact download "*upload.txt" . \ No newline at end of file diff --git a/.buildkite/artifact_plugin.yml b/.buildkite/artifact_plugin.yml new file mode 100644 index 00000000..abf88ac8 --- /dev/null +++ b/.buildkite/artifact_plugin.yml @@ -0,0 +1,12 @@ +steps: + - label: ":test multi line:" + command: ./src/create_artifact.sh + plugins: + - artifacts#v1.9.2: + upload: "./testr/revisions1/foo1.txt" + ignore-missing: false + + - command: "download" + plugins: + - artifacts#v1.9.2: + download: "./testr/revisions1/foo1.txt" diff --git a/.buildkite/block_on_condition.yml b/.buildkite/block_on_condition.yml new file mode 100644 index 00000000..ade1b63d --- /dev/null +++ b/.buildkite/block_on_condition.yml @@ -0,0 +1,3 @@ +steps: +- label: Deploy to testing + command: echo "hello 1" diff --git a/.buildkite/block_step.yml b/.buildkite/block_step.yml new file mode 100644 index 00000000..e1358151 --- /dev/null +++ b/.buildkite/block_step.yml @@ -0,0 +1,21 @@ +steps: + - block: "Release" + prompt: "Fill out the details for release" + fields: + - text: "Release Name" + key: "release-name" + hint: "Think of a cool name for this release" + - text: "Changelog" + key: "release-notes" + required: false + hint: "List of what's changed in this release" + - select: "Type" + key: "release-type" + default: "beta" + options: + - label: "Beta" + value: "beta" + - label: "Stable" + value: "stable" + - command: ./src/release.sh + label: ":rocket:" \ No newline at end of file diff --git a/.buildkite/block_with_dependency.yml b/.buildkite/block_with_dependency.yml new file mode 100644 index 00000000..ca7f0f3a --- /dev/null +++ b/.buildkite/block_with_dependency.yml @@ -0,0 +1,18 @@ +steps: + + - label: 1st step + command: echo "hello" + + - label: 2st step + key: 2 + command: exit -1 + + - block: "Release" + key: 3 + depends_on: 2 + prompt: "check dependency" + blocked_state: failed + + - label: 3rd step + depends_on: 3 + command: echo "hi" diff --git a/.buildkite/blocked.yml b/.buildkite/blocked.yml new file mode 100644 index 00000000..4a8c9ae0 --- /dev/null +++ b/.buildkite/blocked.yml @@ -0,0 +1,22 @@ + +steps: + + - label: Deploy to testing + command: echo "hello" + agents: + multi: 'yes' + + - label: Deploy to staging + command: echo "hello" + agents: + multi: 'yes' + + - label: Deploy to production + command: echo "hello" + agents: + multi: 'yes' + + - label: Deploy to live + agents: + multi: 'yes' + diff --git a/.buildkite/cleanup/test_cleanup.sh b/.buildkite/cleanup/test_cleanup.sh new file mode 100644 index 00000000..a8fcc35d --- /dev/null +++ b/.buildkite/cleanup/test_cleanup.sh @@ -0,0 +1,5 @@ +#!/bin/bash +set -euo pipefail + + +echo "from cleanaup ******" \ No newline at end of file diff --git a/.buildkite/cli_test.yml b/.buildkite/cli_test.yml new file mode 100644 index 00000000..00d3eb55 --- /dev/null +++ b/.buildkite/cli_test.yml @@ -0,0 +1,4 @@ +steps: + + - label: CLI + command: echo "hello" \ No newline at end of file diff --git a/.buildkite/concurrency_gate.yml b/.buildkite/concurrency_gate.yml new file mode 100644 index 00000000..44372bb7 --- /dev/null +++ b/.buildkite/concurrency_gate.yml @@ -0,0 +1,37 @@ +--- +steps: + - command: echo "Running unit tests" + key: unit-tests + agents: + queue: default + - command: echo "--> Start of concurrency gate" + concurrency_group: gate + concurrency: 1 + key: start-gate + depends_on: unit-tests + agents: + queue: default + - wait + - command: echo "Running deployment to staging environment" + key: stage-deploy + depends_on: start-gate + agents: + queue: default + - command: echo "Running e2e tests after the deployment" + parallelism: 3 + depends_on: + - stage-deploy + key: e2e + agents: + queue: default + - wait + - command: echo "End of concurrency gate <--" + concurrency_group: gate + concurrency: 1 + key: end-gate + agents: + queue: default + - command: echo "This and subsequent steps run independently" + depends_on: end-gate + agents: + queue: default diff --git a/.buildkite/custom_checkout.yml b/.buildkite/custom_checkout.yml new file mode 100644 index 00000000..a7996f4d --- /dev/null +++ b/.buildkite/custom_checkout.yml @@ -0,0 +1,3 @@ +steps: +- label: Deploy to testing + command: echo "added" \ No newline at end of file diff --git a/.buildkite/dynamic_step.yml b/.buildkite/dynamic_step.yml new file mode 100644 index 00000000..1952e6c3 --- /dev/null +++ b/.buildkite/dynamic_step.yml @@ -0,0 +1,5 @@ +- block: block step + label: ":robot_face: DO NOT manually unblock. Waiting for external service to unblock" + key: block-step + depends_on: [] + blocked_state: running diff --git a/.buildkite/exit_status.yml b/.buildkite/exit_status.yml new file mode 100644 index 00000000..aff5bd76 --- /dev/null +++ b/.buildkite/exit_status.yml @@ -0,0 +1,10 @@ +steps: + - label: "-1" + command: exit -1 + retry: + automatic: + - exit_status: -1 || 255 + limit: 2 + + - label: "255" + command: exit 255 diff --git a/.buildkite/freeze.yml b/.buildkite/freeze.yml new file mode 100644 index 00000000..a2b1bf18 --- /dev/null +++ b/.buildkite/freeze.yml @@ -0,0 +1,22 @@ +steps: +- label: Verify if freezed + command: echo "testing freeze $FREEZE" + key: "step1" + +- wait: ~ + continue_on_failure: true + +- label: Should we freeze? + command: | + if [ $FREEZE == true ]; then + buildkite-agent annotate "Pipeline is currently under freeze, please contact your team!!" + cat <<- YAML | buildkite-agent pipeline upload + + steps: + - block: ":rocket: Currently under freeze" + branches: main + YAML + fi + +- label: Done + command: echo "done" \ No newline at end of file diff --git a/.buildkite/hooks/bk-post-artifact b/.buildkite/hooks/bk-post-artifact new file mode 100644 index 00000000..173cc731 --- /dev/null +++ b/.buildkite/hooks/bk-post-artifact @@ -0,0 +1,15 @@ +#!/bin/bash +set -euo pipefail + +echo "post-artifact hook, searching for artifact" + +if [ $BUILDKITE_LABEL == ":test multi line:" ]; then + output=$(buildkite-agent artifact search testr/revisions1/foo.txt 2>&1) + status=$? + if [ $status -eq 0 ]; then + echo "Artifact found" + else + echo "Artifact not found or an error occurred" + echo "Error details: $output" + fi +fi \ No newline at end of file diff --git a/.buildkite/hooks/bk-post-command b/.buildkite/hooks/bk-post-command new file mode 100644 index 00000000..b541504a --- /dev/null +++ b/.buildkite/hooks/bk-post-command @@ -0,0 +1,17 @@ +#!/bin/bash +set -euo pipefail + +echo "Post-command hook, searching for artifact" + + +if [ $BUILDKITE_LABEL == ":test multi line:" ]; then + echo "searching for artifact" + output=$(buildkite-agent artifact search testr/revisions1/foo.txt 2>&1) + status=$? + if [ $status -eq 0 ]; then + echo "Artifact found" + else + echo "Artifact not found or an error occurred" + echo "Error details: $output" + fi +fi \ No newline at end of file diff --git a/.buildkite/hooks/bk-pre-exit b/.buildkite/hooks/bk-pre-exit new file mode 100644 index 00000000..b8f9a23e --- /dev/null +++ b/.buildkite/hooks/bk-pre-exit @@ -0,0 +1,11 @@ +#!/bin/bash +set -euo pipefail + +echo "pre-exit hook, searching for artifact" + + +if [ "$BUILDKITE_LABEL" == ":test multi line:" ]; then + + buildkite-agent artifact search testr/revisions1/* + +fi \ No newline at end of file diff --git a/.buildkite/hooks/bk-pre-exit.bk b/.buildkite/hooks/bk-pre-exit.bk new file mode 100644 index 00000000..4fa4fa45 --- /dev/null +++ b/.buildkite/hooks/bk-pre-exit.bk @@ -0,0 +1,25 @@ +#!/bin/bash +set -euo pipefail + +echo "pre-exit hook, running" + + +pwd +ls + + + +cd src + +ls + + +echo "running cleanup script $BUILDKITE_STEP_KEY.sh" + +chmod +x ./$BUILDKITE_STEP_KEY.sh + +./$BUILDKITE_STEP_KEY.sh + + + +echo "script called" \ No newline at end of file diff --git a/.buildkite/hosted_agent.yml b/.buildkite/hosted_agent.yml new file mode 100644 index 00000000..59cdc5b4 --- /dev/null +++ b/.buildkite/hosted_agent.yml @@ -0,0 +1,6 @@ +steps: +- label: testing hosted agent + command: echo $(buildkite-agent secret get 'test') + key: step1 + agents: + queue: hosted_agent \ No newline at end of file diff --git a/.buildkite/job_dependcy.yml b/.buildkite/job_dependcy.yml new file mode 100644 index 00000000..cbefd4fa --- /dev/null +++ b/.buildkite/job_dependcy.yml @@ -0,0 +1,10 @@ +--- +steps: + - command: echo "$(buildkite-agent step get "label" --step "step-b")" + label: "Step A" + key: step-a + depends_on: step-b + + - command: echo "step b" + label: "Step B" + key: step-b diff --git a/.buildkite/kubernetes.yml b/.buildkite/kubernetes.yml new file mode 100644 index 00000000..74ad5104 --- /dev/null +++ b/.buildkite/kubernetes.yml @@ -0,0 +1,14 @@ +steps: +- label: Hello World! + agents: + queue: kubernetes + plugins: + - kubernetes: + podSpec: + containers: + - image: alpine:latest + command: [sh, -c] + name: helloworld + args: + - "'echo Hello World!' && sleep 30" + serviceAccountName: test diff --git a/.buildkite/mono_repo_diff.yml b/.buildkite/mono_repo_diff.yml new file mode 100644 index 00000000..22986e9a --- /dev/null +++ b/.buildkite/mono_repo_diff.yml @@ -0,0 +1,15 @@ +steps: + - label: "Triggering pipelines" + plugins: + - monorepo-diff#v1.0.1: + diff: "git diff --name-only HEAD~1" + watch: + - path: src/ + config: + command: "echo Make Changes cmd with dollar" + - path: + - src/ + config: + trigger: "freeze" + label: ":trigger" + diff --git a/.buildkite/multi_agent.yml b/.buildkite/multi_agent.yml new file mode 100644 index 00000000..46927ba7 --- /dev/null +++ b/.buildkite/multi_agent.yml @@ -0,0 +1,4 @@ +steps: + - command: "echo parallel test" + label: "Test %n" + parallelism: 5 \ No newline at end of file diff --git a/.buildkite/multi_line_env.yml b/.buildkite/multi_line_env.yml new file mode 100644 index 00000000..80978e5e --- /dev/null +++ b/.buildkite/multi_line_env.yml @@ -0,0 +1,10 @@ +steps: +- label: ":test multi line:" + command: ./src/test_artifact.sh + key: test1 + +- label: ":test multi line:" + command: ./src/multi_line.sh + depends_on: test1 + soft_fail: + - exit_status: 1 diff --git a/.buildkite/oidc-test.yml b/.buildkite/oidc-test.yml new file mode 100644 index 00000000..267abaf9 --- /dev/null +++ b/.buildkite/oidc-test.yml @@ -0,0 +1,4 @@ +steps: +- label: Verify oidc token + command: echo $(buildkite-agent oidc request-token --audience sts.amazonaws.com) + key: "step1" \ No newline at end of file diff --git a/.buildkite/package.yml b/.buildkite/package.yml new file mode 100644 index 00000000..8cf21d1e --- /dev/null +++ b/.buildkite/package.yml @@ -0,0 +1,3 @@ +steps: + - label: ":construction_worker: Build" + command: docker login buildkitepackages.com -u buildkite -p $PKG_TOKEN | docker pull buildkitepackages.com/018e63f3-572a-4663-878e-259aaaf3d636/018fb786-e2a0-7212-8a41-ebfb5ddf9acf/alpine:latest diff --git a/.buildkite/per-host-concurrency.yml b/.buildkite/per-host-concurrency.yml new file mode 100644 index 00000000..f461c8e7 --- /dev/null +++ b/.buildkite/per-host-concurrency.yml @@ -0,0 +1,19 @@ +--- +steps: + - command: echo "Running unit tests" + key: unit-tests + agents: + queue: default + - command: echo "--> Start of concurrency gate" + concurrency_group: matchingApi/lint-test-${BUILDKITE_AGENT_NAME} + concurrency: 1 + key: start-gate + depends_on: unit-tests + agents: + queue: default + - wait + - command: echo "Running deployment to staging environment" + key: stage-deploy + depends_on: start-gate + agents: + queue: default \ No newline at end of file diff --git a/.buildkite/pipeline.dynamic-steps.yml b/.buildkite/pipeline.dynamic-steps.yml new file mode 100644 index 00000000..ef0c4068 --- /dev/null +++ b/.buildkite/pipeline.dynamic-steps.yml @@ -0,0 +1,6 @@ +steps: +- label: ":ballot_box_with_ballot:" + command: echo "hello" + +- label: ":pipeline:" + command: "buildkite-agent pipeline upload .buildkite/dynamic_step.yml" diff --git a/.buildkite/plugin.yml b/.buildkite/plugin.yml new file mode 100644 index 00000000..0233d63e --- /dev/null +++ b/.buildkite/plugin.yml @@ -0,0 +1,37 @@ +--- +env: + VERSION: 4992-944dd165 +steps: +- label: upload files + command: | + set -x + ls -alh + mkdir -p build/osie-4992-944dd165/ + mv *x86_64* build/osie-4992-944dd165/ + ls -alh build/osie-4992-944dd165/ + rm build/osie-4992-944dd165/*.mk + /usr/bin/buildkite-agent artifact upload "build/osie-4992-944dd165/*" +- wait +- label: ":qemu:\U0001F131\U0001F138\U0001F13E\U0001F142 x86_64" + command: | + set -x + pwd + rm -f *x86_64* + ls -alh || : + ls -alhR build || : + /app/vm.sh + plugins: + - github.com/buildkite-plugins/artifacts-buildkite-plugin#v1.9.3: + download: + - build/osie-4992-944dd165/*x86_64* + - github.com/buildkite-plugins/docker-buildkite-plugin#v5.11.0: + image: quay.io/equinixmetal/osie-vm-tests:33-1be79cba + volumes: + - "/var/run/docker.sock:/var/run/docker.sock" + - "./build/osie-:/workdir" + workdir: "/workdir/build/osie-4992-944dd165" + privileged: true + skip-checkout: true + mount-checkout: false + propagate-environment: true + timeout_in_minutes: 60 diff --git a/.buildkite/simple.yml b/.buildkite/simple.yml new file mode 100644 index 00000000..306ac510 --- /dev/null +++ b/.buildkite/simple.yml @@ -0,0 +1,6 @@ +steps: + - label: "test" + key: "one" + command: echo "4ede" | buildkite-agent meta-data set "dd_tags.team" "priya_pipeline" + + diff --git a/.buildkite/sparse_checkout.yml b/.buildkite/sparse_checkout.yml new file mode 100644 index 00000000..01dff2f1 --- /dev/null +++ b/.buildkite/sparse_checkout.yml @@ -0,0 +1,9 @@ +steps: + - label: Pipeline upload + command: echo "runnign sparse" + key: "step1" + plugins: + - ssh://git@github.com/buildkite-plugins/sparse-checkout-buildkite-plugin.git:v0.01: + paths: .buildkite + - trigger: "test-md-git-commit" + label: "testing triggering" diff --git a/.buildkite/step_notification.yml b/.buildkite/step_notification.yml new file mode 100644 index 00000000..99d2d3b2 --- /dev/null +++ b/.buildkite/step_notification.yml @@ -0,0 +1,21 @@ +steps: + - command: echo "hello" + key: 'step1' + + - wait: ~ + continue_on_failure: true + + - label: "Run only if above pass" + command: | + if [ $$(buildkite-agent step get "outcome" --step "step1") == "passed" ]; then + cat <<- YAML | buildkite-agent pipeline upload + steps: + - label: "Notify slack about soft passed step" + command: echo "Notifying slack about the passed step" + notify: + - slack: + channels: + - "#priya-test" + message: "Step1 has passed. <@U06PNF3JFHR> " + YAML + fi \ No newline at end of file diff --git a/.buildkite/teams_notification.yml b/.buildkite/teams_notification.yml new file mode 100644 index 00000000..93fca957 --- /dev/null +++ b/.buildkite/teams_notification.yml @@ -0,0 +1,9 @@ +--- +steps: + + + - label: "\U0001F4AD Sending Teams Notification" + plugins: + - github.com/buildkite-plugins/teams-notification-buildkite-plugin#0.0.1: + message: From Buildkite with Love + webhook_url: "" \ No newline at end of file diff --git a/.buildkite/test_go.yml b/.buildkite/test_go.yml new file mode 100644 index 00000000..9feba65f --- /dev/null +++ b/.buildkite/test_go.yml @@ -0,0 +1,7 @@ +steps: + - name: ":go::robot_face: Lint" + key: lint + command: ./src/set_go.sh + plugins: + - docker#v5.9.0: + image: "golang:1.22" \ No newline at end of file diff --git a/.buildkite/test_py.yml b/.buildkite/test_py.yml new file mode 100644 index 00000000..ca95bcf5 --- /dev/null +++ b/.buildkite/test_py.yml @@ -0,0 +1,6 @@ +steps: + - label: "test if python installed in the custom image" + command: python3.12 --version + + - label: "test if pip installed in the custom image" + command: pip3.12 --version diff --git a/.buildkite/test_sparse.yml b/.buildkite/test_sparse.yml new file mode 100644 index 00000000..cb3763c8 --- /dev/null +++ b/.buildkite/test_sparse.yml @@ -0,0 +1,14 @@ +steps: + - label: Pipeline upload + command: buildkite-agent pipeline upload + plugins: + - sparse-checkout: + paths: + - .buildkite + + - command: exit -1 + key: 'step1' + + - command: echo "hello one" + depends_on: step1 + key: 'step2' diff --git a/.buildkite/trigger.yml b/.buildkite/trigger.yml new file mode 100644 index 00000000..631e305d --- /dev/null +++ b/.buildkite/trigger.yml @@ -0,0 +1,10 @@ +- label: Testing triggers + command: echo "hello" + +- trigger: "step-notification" + label: ":rocket: Deploy event trigger" + branches: main + build: + meta_data: + release-version: "1.1" + diff --git a/artifact.txt b/artifact.txt new file mode 100644 index 00000000..e69de29b diff --git a/src/create_artifact.sh b/src/create_artifact.sh new file mode 100644 index 00000000..49b4f729 --- /dev/null +++ b/src/create_artifact.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +set -e + +pwd + +mkdir testr +cd testr +pwd +mkdir revisions1 +cd revisions1 +pwd +touch foo.txt + +ls \ No newline at end of file diff --git a/src/fetch-and-display-number.sh b/src/fetch-and-display-number.sh new file mode 100755 index 00000000..1e92c836 --- /dev/null +++ b/src/fetch-and-display-number.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +set -e \ No newline at end of file diff --git a/src/generate-and-store-number.sh b/src/generate-and-store-number.sh new file mode 100755 index 00000000..b68c16a5 --- /dev/null +++ b/src/generate-and-store-number.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +set -e + +buildkite-agent meta-data set generated-number "3" + +echo "number is $i" \ No newline at end of file diff --git a/src/generate-steps-from-stored-number.sh b/src/generate-steps-from-stored-number.sh new file mode 100755 index 00000000..c5eb5942 --- /dev/null +++ b/src/generate-steps-from-stored-number.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +set -e + +steps_count=$(buildkite-agent meta-data get generated-number) + +buildkite-agent meta-data set steps-count "$steps_count" + +echo "steps:" +for((i=0;i +fi \ No newline at end of file diff --git a/src/one.sh b/src/one.sh new file mode 100644 index 00000000..0e581891 --- /dev/null +++ b/src/one.sh @@ -0,0 +1,5 @@ +#!/bin/bash +set -euo pipefail + + +echo "from cleanaup ****** $BUILDKITE_STEP_KEY" \ No newline at end of file diff --git a/src/python/check_status.py b/src/python/check_status.py new file mode 100644 index 00000000..e69de29b diff --git a/src/release.sh b/src/release.sh new file mode 100755 index 00000000..52c83537 --- /dev/null +++ b/src/release.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +set -e + +name=$(buildkite-agent meta-data get "release-name") +notes=$(buildkite-agent meta-data get "release-notes") +type=$(buildkite-agent meta-data get "release-type") + +echo "Release name chosen $name" + +echo "Release notes $notes" + +echo "Release type $type" \ No newline at end of file diff --git a/src/set_go.sh b/src/set_go.sh new file mode 100755 index 00000000..5bb8c32f --- /dev/null +++ b/src/set_go.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +set -Eeufo pipefail + +echo --- :go: Checking go mod tidiness +go mod tidy +if ! git diff --no-ext-diff --exit-code; then + echo ^^^ +++ + echo "The go.mod or go.sum files are out of sync with the source code" + echo "Please run \`go mod tidy\` locally, and commit the result." + + exit 1 +fi + +echo --- :go: Checking go formatting +gofmt -w . +if ! git diff --no-ext-diff --exit-code; then + echo ^^^ +++ + echo "Files have not been formatted with gofmt." + echo "Fix this by running \`go fmt ./...\` locally, and committing the result." + + exit 1 +fi + +echo +++ Everything is clean and tidy! 🎉 \ No newline at end of file diff --git a/src/test.py b/src/test.py new file mode 100644 index 00000000..e69de29b diff --git a/src/test_artifact.sh b/src/test_artifact.sh new file mode 100644 index 00000000..6692329e --- /dev/null +++ b/src/test_artifact.sh @@ -0,0 +1,8 @@ + +#!/bin/bash + +set -e + + +touch foo.txt +buildkite-agent artifact upload "foo.txt" \ No newline at end of file diff --git a/src/test_cleanup.sh b/src/test_cleanup.sh new file mode 100644 index 00000000..a8fcc35d --- /dev/null +++ b/src/test_cleanup.sh @@ -0,0 +1,5 @@ +#!/bin/bash +set -euo pipefail + + +echo "from cleanaup ******" \ No newline at end of file diff --git a/src/two.sh b/src/two.sh new file mode 100644 index 00000000..e69de29b diff --git a/src/verify_block.sh b/src/verify_block.sh new file mode 100644 index 00000000..e69de29b diff --git a/test.txt b/test.txt new file mode 100644 index 00000000..00a991ec --- /dev/null +++ b/test.txt @@ -0,0 +1 @@ +just test for merge group diff --git a/upload.txt b/upload.txt new file mode 100644 index 00000000..d606037c --- /dev/null +++ b/upload.txt @@ -0,0 +1 @@ +test2 \ No newline at end of file