diff --git a/.circleci/test-deploy.yml b/.circleci/test-deploy.yml index b026448..71224ce 100644 --- a/.circleci/test-deploy.yml +++ b/.circleci/test-deploy.yml @@ -15,8 +15,7 @@ jobs: - image: cimg/base:current steps: - checkout - # Run your orb's commands to validate them. - - workflow-queue/greet + - workflow-queue/queue workflows: test-deploy: jobs: diff --git a/.yamllint b/.yamllint index c9a8a2e..d48c2d3 100644 --- a/.yamllint +++ b/.yamllint @@ -4,4 +4,3 @@ rules: line-length: max: 200 allow-non-breakable-inline-mappings: true - diff --git a/src/commands/greet.yml b/src/commands/greet.yml deleted file mode 100755 index f4e2205..0000000 --- a/src/commands/greet.yml +++ /dev/null @@ -1,15 +0,0 @@ -description: > - This command echos "Hello World" using file inclusion. -# What will this command do? -# Descriptions should be short, simple, and clear. -parameters: - to: - type: string - default: "World" - description: "Hello to whom?" -steps: - - run: - environment: - PARAM_TO: <> - name: Hello Greeting - command: <> diff --git a/src/commands/queue.yml b/src/commands/queue.yml new file mode 100755 index 0000000..dc80062 --- /dev/null +++ b/src/commands/queue.yml @@ -0,0 +1,37 @@ +description: > + This command is executed and blocks further execution until the necessary criteria is met. + +parameters: + debug: + type: boolean + default: true + description: "If enabled, DEBUG messages will be logged." + time: + type: string + default: "10" + description: "Minutes to wait before giving up." + dont-quit: + type: boolean + default: false + description: "Force job through once time expires instead of failing." + only-on-branch: + type: string + default: "*" + description: "Only queue on specified branch" + confidence: + type: string + default: "1" + description: > + Due to concurrency issues, how many times should we requery the pipeline list to ensure previous jobs are "pending", + but not yet active. This number indicates the threshold for API returning no previous pending pipelines. + Default is one confirmation, increase if you see issues. + circleci-user-auth: + type: env_var_name + default: CIRCLECI_USER_AUTH + description: "In the event you wish to supply CCI basic-auth credentials via a different environment value, set the name here." +steps: +- run: + name: Queue Until Front of Line + environment: + DEBUG_ENABLED: "<< parameters.debug >>" + command: <> diff --git a/src/executors/default.yml b/src/executors/default.yml deleted file mode 100755 index ca3f5dc..0000000 --- a/src/executors/default.yml +++ /dev/null @@ -1,12 +0,0 @@ -description: > - This is a sample executor using Docker and Node. If you want to provide a custom environment in your orb, insert your image here. - If you do not require an executor, you can simply delete this directory. -docker: - - image: 'cimg/node:<>' -parameters: - tag: - default: lts - description: > - Pick a specific cimg/node image variant: - https://hub.docker.com/r/cimg/node/tags - type: string diff --git a/src/jobs/hello.yml b/src/jobs/hello.yml deleted file mode 100755 index 8f1df04..0000000 --- a/src/jobs/hello.yml +++ /dev/null @@ -1,14 +0,0 @@ -description: > - Sample description -# What will this job do? - -executor: default - -parameters: - to: - type: string - default: "World" - description: "Hello to whom?" -steps: - - greet: - to: << parameters.to >> diff --git a/src/jobs/queue.yml b/src/jobs/queue.yml new file mode 100755 index 0000000..5749b95 --- /dev/null +++ b/src/jobs/queue.yml @@ -0,0 +1,44 @@ +description: > + This job is executed and blocks further execution until the necessary criteria is met. + +docker: + - image: cimg/base:stable +resource_class: small + +parameters: + debug: + type: boolean + default: false + description: "If enabled, DEBUG messages will be logged." + time: + type: string + default: "10" + description: "Minutes to wait before giving up." + dont-quit: + type: boolean + default: false + description: "Force job through once time expires instead of failing." + only-on-branch: + type: string + default: "*" + description: "Only queue on specified branch" + confidence: + type: string + default: "1" + description: > + Due to concurrency issues, how many times should we requery the pipeline list to ensure previous jobs are "pending", + but not yet active. This number indicates the threshold for API returning no previous pending pipelines. + Default is one confirmation, increase if you see issues. + circleci-user-auth: + type: env_var_name + default: CIRCLECI_USER_AUTH + description: "In the event you wish to supply CCI basic-auth credentials via a different environment value, set the name here." + +steps: + - queue: + debug: << parameters.debug >> + time: <> + dont-quit: <> + only-on-branch: <> + confidence: <> + circleci-user-auth: <> diff --git a/src/scripts/greet.sh b/src/scripts/greet.sh deleted file mode 100644 index f01be79..0000000 --- a/src/scripts/greet.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -echo Hello "${PARAM_TO}" \ No newline at end of file diff --git a/src/scripts/queue.sh b/src/scripts/queue.sh new file mode 100644 index 0000000..70cc5be --- /dev/null +++ b/src/scripts/queue.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +debug() { + if [ -n "${DEBUG_ENABLED}" ]; then + echo "DEBUG: ${*}" + fi +} + +debug "this is a test" +echo "this is a test"