diff --git a/.circleci/config.yml b/.circleci/config.yml index 9b10b3b..91bd608 100755 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,24 +1,123 @@ version: 2.1 +# add your orb below, to be used in integration tests (note: a @dev:alpha +# release must exist; you'll need to publish manually at least once) +# you can use scripts/publish-alpha.sh to publish a @dev:alpha release orbs: + fuzzit: fuzzitdev/fuzzit@dev:alpha orb-tools: circleci/orb-tools@8.27.3 - shellcheck: circleci/shellcheck@1.3.14 - -jobs: - getting-started: - docker: - - image: circleci/node - steps: - - run: - name: Getting Started - command: | - echo "Your orb is now building on CircleCI" - echo "This is a temporary configuration file. Continue with the orb-init.sh script and follow the README.md to publish your orb." + workflows: - setup: + # this `lint-pack_validate_publish-dev` workflow will run on any commit + lint-pack_validate_publish-dev: jobs: - - getting-started + # lint your destructured orb YAML files - orb-tools/lint - - shellcheck/check: - ignore: 'SC1090,SC2034,SC2059,SC2001,SC2143,SC2046' + # pack your orb YAML files to a single orb.yml + # validate the orb.yml file to ensure it is well-formed + - orb-tools/pack: + requires: + - orb-tools/lint + + # release dev version of orb, for testing & possible publishing + # requires a CircleCI API token to be stored as CIRCLE_TOKEN (default) + # https://circleci.com/docs/2.0/managing-api-tokens + # store CIRCLE_TOKEN as a project env var or Contexts resource + # if using Contexts, add your context below + - orb-tools/publish-dev: + orb-name: fuzzitdev/fuzzit + requires: + - orb-tools/pack + + # trigger an integration workflow to test the dev version of your orb + # an SSH key must be stored in your orb's repository and in CircleCI + # (add the public key as a read/write key on GitHub; add the private + # key in CircleCI via SSH Permissions, with github.com as Hostname) + - orb-tools/trigger-integration-workflow: + name: trigger-integration-dev + ssh-fingerprints: 28:e3:ab:d2:77:42:9e:c5:12:76:a6:8c:46:af:5e:c7 + requires: + - orb-tools/publish-dev + filters: + branches: + ignore: master + + # by default, the 1st job (above) will trigger only integration tests; + # the 2nd job (below) may also publish a production orb version + - orb-tools/trigger-integration-workflow: + name: trigger-integration-master + cleanup-tags: true + ssh-fingerprints: 28:e3:ab:d2:77:42:9e:c5:12:76:a6:8c:46:af:5e:c7 + tag: master + requires: + - orb-tools/publish-dev + filters: + branches: + only: master + + # this `integration-tests_prod-release` workflow will ignore commits + # it is only triggered by git tags, which are created in the job above + # integration-tests_prod-release: + # jobs: + # # - your integration test jobs go here + # # - you will want to call each integration testing job twice, + # # - each under a different name: + # # - once, for integration tests triggered by non-master-branch commits + # # - and again, for tests triggered by commits to master + # # - only commits to master should potentially trigger a prod release + + # # patch, minor, or major publishing + # - orb-tools/dev-promote-prod: + # name: dev-promote-patch + # orb-name: circleci/orb-tools + # ssh-fingerprints: # your SSH key fingerprint + # cleanup-tags: true + # requires: + # # - your integration testing jobs go here + # filters: + # branches: + # ignore: /.*/ + # tags: + # only: /master-patch.*/ + + # - orb-tools/dev-promote-prod: + # name: dev-promote-minor + # release: minor + # orb-name: circleci/orb-tools + # ssh-fingerprints: # your SSH key fingerprint + # cleanup-tags: true + # requires: + # # - your integration testing jobs go here + # filters: + # branches: + # ignore: /.*/ + # tags: + # only: /master-minor.*/ + + # - orb-tools/dev-promote-prod: + # name: dev-promote-major + # release: major + # orb-name: circleci/orb-tools + # ssh-fingerprints: # your SSH key fingerprint + # cleanup-tags: true + # requires: + # # - your integration testing jobs go here + # filters: + # branches: + # ignore: /.*/ + # tags: + # only: /master-major.*/ + +# yaml anchor filters +integration-dev_filters: &integration-dev_filters + branches: + ignore: /.*/ + tags: + only: /integration-.*/ + +integration-master_filters: &integration-master_filters + branches: + ignore: /.*/ + tags: + only: /master-.*/ diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..485dee6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea diff --git a/README.md b/README.md index 7c2b812..73cd01b 100755 --- a/README.md +++ b/README.md @@ -1,148 +1,49 @@ -# Orb Starter Kit [![CircleCI Build Status](https://circleci.com/gh/CircleCI-Public/orb-starter-kit.svg?style=shield "CircleCI Build Status")](https://circleci.com/gh/CircleCI-Public/orb-starter-kit) [![CircleCI Community](https://img.shields.io/badge/community-CircleCI%20Discuss-343434.svg)](https://discuss.circleci.com/c/ecosystem/orbs) +# Fuzzit Orb for CircleCI -This orb starter kit will help you write your own orb. +## What is Fuzzit Orb -Orbs are reusable [commands](https://circleci.com/docs/2.0/reusing-config/#authoring-reusable-commands), [executors](https://circleci.com/docs/2.0/reusing-config/#authoring-reusable-executors), and [jobs](https://circleci.com/docs/2.0/reusing-config/#jobs-defined-in-an-orb) (as well as [usage examples](https://github.com/CircleCI-Public/config-preview-sdk/blob/v2.1/docs/usage-examples.md))—snippets of CircleCI configuration—that can be shared across teams and projects. See [CircleCI Orbs](https://circleci.com/orbs), [Explore Orbs](https://circleci.com/orbs/registry), [Creating Orbs](https://circleci.com/docs/2.0/creating-orbs), and [Using Orbs](https://circleci.com/docs/2.0/using-orbs) for further information. - -## What is in this kit? - -In this Orb-Starter-Kit you will find an automated setup to create a development pipeline to build your orb automatically. Once setup is complete you will have a functioning hello-world orb that is automatically built and released on each commit. Commits to the `master` branch will trigger production Orb releases and other branches will create development versions of your Orb for testing. - -### Prerequisites - -Before getting started you will need the the following things: -1. A CircleCI [account](https://circleci.com/signup/). -2. Git installed and configured locally. -3. A CircleCI [Personal API Token](https://circleci.com/docs/2.0/managing-api-tokens/#creating-a-personal-api-token) (Must be Org admin to claim a namespace and publish production Orbs) -4. A GitHub [Personal Access Token](https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line) (Requires Repo access and Admin Org if pushing to an Org that is not your personal account) +This orb helps integrate continuous fuzzing via Fuzzit.dev to your CircleCI workflow. +This orb provides 3 main features: downloading latest version fo fuzzit cli, running fuzzing +on fuzzit.dev and running local fuzzing regression. ## Usage -### Getting started -1. Download this repository and unzip it. [Download here](https://github.com/CircleCI-Public/orb-starter-kit/archive/master.zip) - -2. Rename the folder to the name you would like to give your orb. - -3. Run the `orb-init.sh` script to begin. -> The Orb Init script will automate the following tasks: -> * Install and update the CircleCI CLI -> * Request a CircleCI API token if none is currently set. -> * Set the target GitHub organization. -> * Set the target repo name (based off the folder name by default). -> * Create the GitHub repository. -> * Follow the project on CircleCI -> * Create a public/private key pair. -> * Store public key on GitHub. -> * Store private key on CircleCI (This gives the starter kit the ability to push tags back to GitHub, currently utilized to automatically trigger integration testing and deployment workflows). -> * Delete these keys locally. -> * Create an Alpha branch -> * Modify and replace config.yml file with pre-configured Orb Starter Kit config. -> * Commit new branch with changes to GitHub. -> * Clean up - The script will remove itself from the repo for the next commit. -> -> At this point the script will provide you a link to your new running Workflow on CircleCI which will be automatically building a "hello world" orb, which will be available at `/@dev:Alpha` - - -4. Begin editing. -> Once the script has finished you may edit the contents of the /src folder to customize your orb. - -5. Create your dev Orb! -> All commits to non-master branches will automatically result in the creation of a development orb under that branch. It is recommended currently (changes incoming) all changes be made under the automatically created Alpha branch. - -6. Publish! -> Merge to master and automatically publish a new production version of your Orb! -> -> You will need to manually publish the production version of your Orb the first time it is created. This is not needed on subsequent pushes. *NOTE* currently _all_ 'major' changes as defined by the Orbs-Tool Orb require manual publishing. All minor and patch changes will be automatically published. - -Once the orb is complete, you will have two new Green workflows in your CircleCI account. The first one is for the initial setup and the second one will have produced a development version of your orb which contains a sample Command, Executor, and Job. - -You may now simply modify these examples and add your own. Any new commit to the repo automatically trigger a development pipeline - -#### What happens when I push a commit? - -The Orb CI/CD pipeline begins! Your Orb will go through the `lint-pack_validate_publish-dev` workflow. The code will first be linted, then passed to the "pack" job which will take your multiple partial yaml files and condense them into a single Orb.yml file, lastly, if specified within the `config.yml`, and defined integration tests will also be ran. - -Based on the branch you push to, the workflow will automatically create a development version of your orb for any branch except for "Master" which will create a production release which will be automatically incremented. - -### Writing your orb -This orb provides a basic directory/file structure for a decomposed orb (where commands, jobs, examples, and executors each live in their own YAML file). Create each of your commands, jobs, examples, and executors within the requisite folders in the `src` directory. - -Following are some resources to help you build and test your orb: +#### Download only -- [Tips for writing your first orb](https://circleci.com/blog/tips-for-writing-your-first-orb/) -- [How to make an easy and valuable open source contribution with CircleCI orbs](https://circleci.com/blog/how-to-make-an-easy-and-valuable-open-source-contribution-with-circleci-orbs/) -- Creating automated build, test, and deploy workflows for orbs: [part 1](https://circleci.com/blog/creating-automated-build-test-and-deploy-workflows-for-orbs/), [part 2](https://circleci.com/blog/creating-automated-build-test-and-deploy-workflows-for-orbs-part-2/) - -### Permissions - -Explanation of all permissions required for the script. - -* **sudo** - The CircleCI CLI Update command will request sudo permissions to update. -* **GitHub personal access token** - Used to automatically create the repository for you. Will require full "repo" access. -* **SSH keys** - A public key is added to the repo on GitHub, CircleCI will hold the private key. This is used to automatically create tagged commits from within the Workflow to enable integration testing. +```yaml +version: 2.1 +orbs: + fuzzit: fuzzitdev/fuzzit@x.y.z +jobs: + build: + docker: + - image: circleci/golang:1.12 + working_directory: /go/src/github.com/fuzzitdev/example-go -
-Preview "Hello-World" Orb produced by this repo by default. + steps: + - checkout + - fuzzit/download + - run: ./fuzzit.sh fuzzing +``` +#### Download + fuzzing/local-regression ```yaml -commands: - greet: - description: | - Replace this text with a description for this command. # What will this command do? # Descriptions should be short, simple, and clear. - parameters: - greeting: - default: Hello - description: Select a proper greeting - type: string - steps: - - run: - command: echo << parameters.greeting >> world - name: Hello World -description: | - Sample orb description # What will your orb allow users to do? # Descriptions should be short, simple, and clear. -examples: - example: - description: | - Sample example description. # What will this example document? # Descriptions should be short, simple, and clear. - usage: - jobs: - build: - machine: true - steps: - - foo/hello: - username: Anna - orbs: - foo: bar/foo@1.2.3 - version: 2.1 -executors: - default: - description: | - This is a sample executor using Docker and Node. # What is this executor? # Descriptions should be short, simple, and clear. +version: 2.1 +orbs: + fuzzit: fuzzitdev/fuzzit@x.y.z +jobs: + build: docker: - - image: circleci/node:<> - parameters: - tag: - default: latest - description: | - Pick a specific circleci/node image variant: https://hub.docker.com/r/circleci/node/tags - type: string -jobs: - hello: - description: | - # What will this job do? # Descriptions should be short, simple, and clear. - executor: default - parameters: - greeting: - default: Hello - description: Select a proper greeting - type: string + - image: circleci/golang:1.12 + working_directory: /go/src/github.com/fuzzitdev/example-go + steps: - - greet: - greeting: << parameters.greeting >> -orbs: - hello: circleci/hello-build@0.0.5 -version: 2.1 + - checkout + - fuzzit/fuzzing # or local-regression, this will call the fuzzit.sh script ``` -
+#### Additional parameters + +`FUZZIT_API_KEY` should be passed. More info about the fuzzit CLI can be found at +[https://github.com/fuzzitdev/fuzzit](https://github.com/fuzzitdev/fuzzit) diff --git a/_init/README.md b/_init/README.md deleted file mode 100755 index 90c93f1..0000000 --- a/_init/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# orb-init partials - -This directory contains functions used within the orb-init.sh script. It is not a part of the Orb source and should not be committed to the repo. diff --git a/_init/_CCIAddSecrets.sh b/_init/_CCIAddSecrets.sh deleted file mode 100755 index cce6ac5..0000000 --- a/_init/_CCIAddSecrets.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -_CCIAddSecrets() { - printf "\e[1mCreating deployment key.\e[0m\n" - sleep 2 - echo "The private key will automatically be added to the CircleCI repository for this project, and the public key will be added to the GitHub org. This will allow the Workflow to publish tagged commits to trigger integration tests and production Orb deployments." - # Generate SSH key pair - ssh-keygen -t rsa -b 4096 -m PEM -N "" -f "${CCI_ORBNAME}-key" - echo - echo "${CCI_ORBNAME}-key keypair has been created" - # Generate fingerprint locally - CCI_FINGERPRINT=$(ssh-keygen -E md5 -lf "${CCI_ORBNAME}-key" | awk '{print $2}' | sed 's/^....//') - echo "Private key fingerprint: $CCI_FINGERPRINT" - echo - sleep 1 - # Add Private key to CircleCI. - echo "Adding private key to CircleCI" - CCI_KEY_RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" -X POST --header "Content-Type: application/json" -d "{\"hostname\":\"github.com\",\"private_key\":\"$(cat "$CCI_ORBNAME-key")\"}" "https://circleci.com/api/v1.1/project/github/${CCI_ORGANIZATION}/${CCI_REPO}/ssh-key?circle-token=${CCI_TOKEN}") - if [ ! "$CCI_KEY_RESPONSE" == "200" ] - then - echo "Failed to add private key to CircleCI. Please try again later." - exit 1 - else - echo "...private key added to CircleCI" - fi - # Add CIRCLE_TOKEN env var to CircleCI - echo - echo "Adding CIRCLE_TOKEN env var to project on CircleCI" - CCI_TOKEN_ENV_RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" -X POST --header "Content-Type: application/json" -d "{\"name\":\"CIRCLE_TOKEN\", \"value\":\"$CCI_TOKEN\"}" "https://circleci.com/api/v1.1/project/github/${CCI_ORGANIZATION}/${CCI_REPO}/envvar?circle-token=${CCI_TOKEN}") - if [ ! "$CCI_TOKEN_ENV_RESPONSE" == "201" ] - then - echo "Failed to add CIRCLE_TOKEN env var to CircleCI. Please try again later." - exit 1 - else - echo "...CIRCLE_TOKEN env var added to CircleCI" - fi - # Adding public key to GitHub. - echo "Adding public key to GitHub." - GIT_KEY_RESPONSE=$(curl --silent -u "$CCI_ORGANIZATION:$CCI_GH_TOKEN" -X POST --header "Content-Type: application/json" -d "{\"title\":\"orb-deploy\",\"key\":\"$(cat "$CCI_ORBNAME-key.pub")\",\"read_only\":false}" "https://api.github.com/repos/${CCI_ORGANIZATION}/${CCI_REPO}/keys" | grep -q "\"verified\": true") - if [ -z "$GIT_KEY_RESPONSE" ]; - then - echo "...Public key added to GitHub." - else - echo "Failed to add public key to Github. Please try again later." - echo "Printing error" - echo "$GIT_KEY_RESPONSE" - echo - exit 1 - fi - echo "Keys added" - echo "Removing local keys" - rm "${CCI_ORBNAME}-key" - rm "${CCI_ORBNAME}-key.pub" - echo -} \ No newline at end of file diff --git a/_init/_checkGithubAuth.sh b/_init/_checkGithubAuth.sh deleted file mode 100755 index db0e748..0000000 --- a/_init/_checkGithubAuth.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -_checkGithubAuth() { - GITAUTHCHECK=$(ssh -T git@github.com 2>&1) - if [ -z $(echo "$GITAUTHCHECK" | grep -o "success") ] - then - printf "\e[1m\e[91mUnable to authenticate with GitHub\e[0m\n" - echo "It doesn't appear you are authenticated with Github." - echo "Ensure you have added your SSH keypair to enable pushing and pulling from this environment" - echo "https://help.github.com/en/articles/adding-a-new-ssh-key-to-your-github-account" - sleep 2 - exit 1 - else - GITHUB_USER=$(echo "$GITAUTHCHECK" | cut -d " " -f 2 | tr -d "!") - printf "\e[92mAuthenticated\e[0m\n" - echo "Welcome $GITHUB_USER" - echo - fi -} \ No newline at end of file diff --git a/_init/_checkOrgName.sh b/_init/_checkOrgName.sh deleted file mode 100755 index fa65753..0000000 --- a/_init/_checkOrgName.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash -_checkOrgName() { - # check and set flag for personal or organizational repo - printf "\e[1m\nRepo Type: Personal or Organization?\e[0m\n" - select REPO_TYPE in Personal Organization - do - case $REPO_TYPE in - "Personal") - printf " You have selected to use a Personal repo\n\n" - #standardize to org variable - CCI_ORGANIZATION="$GITHUB_USER" - break - ;; - "Organization") - printf " You have selected to use an Organization repo\n\n" - printf "\e[1mEnter your GitHub Organization name\e[0m\n" - read -p "Enter GitHub Orginzation name: " -r CCI_ORGANIZATION - echo - printf "\e[1mYou have selected \e[36m%s\e[39m is this correct?\e[0m\n" "$CCI_ORGANIZATION" - read -p "Enter [y/n]: " -n 1 -r - if [[ "$REPLY" =~ ^[Yy] ]] - then - echo - echo "Organization set" - else - _checkOrgName - fi - break - ;; - *) - echo "Invalid" - _checkOrgName - ;; - esac - done -} diff --git a/_init/_checkRepoName.sh b/_init/_checkRepoName.sh deleted file mode 100755 index 3da2f94..0000000 --- a/_init/_checkRepoName.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -_checkRepoName() { - echo - printf "\e[1mThe repoistory name is currently set to \e[36m$(basename "$PWD")\e[39m is this correct?\e[0m\n" - read -p "Enter [y/n]: " -n 1 -r - if [[ "$REPLY" =~ ^[Yy]$ ]] - then - echo - CCI_REPO=$(basename "$PWD") - elif [[ "$REPLY" =~ ^[Nn]$ ]] - then - echo - read -p "Enter GitHub repoistory name: " -r CCI_REPO - else - _checkRepoName - fi -} \ No newline at end of file diff --git a/_init/_cleanup.sh b/_init/_cleanup.sh deleted file mode 100755 index 4539fa6..0000000 --- a/_init/_cleanup.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -_cleanup() { - echo " ...cleaning up" - rm -rf _init - echo " ...init script removed" - rm -f "$0" - exit 0 -} \ No newline at end of file diff --git a/_init/_editConfig.sh b/_init/_editConfig.sh deleted file mode 100755 index 71f8626..0000000 --- a/_init/_editConfig.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -_editConfig() { - echo "Modifying config template" - # replace all instances of namespace name - sed -i .bak "s//$CCI_NAMESPACE/g" config.yml - # replace all instances of orb name - sed -i .bak "s//$CCI_ORBNAME/g" config.yml - # replace all instances of fingerprint value - sed -i .bak "s//$CCI_FINGERPRINT/g" config.yml - echo "Config has been modified" -} \ No newline at end of file diff --git a/_init/_followProject.sh b/_init/_followProject.sh deleted file mode 100755 index bdbb4fb..0000000 --- a/_init/_followProject.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -_followProject() { - CCI_FOLLOW_RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" -X POST https://circleci.com/api/v1.1/project/github/"${CCI_ORGANIZATION}"/"${CCI_REPO}"/follow?circle-token="${CCI_TOKEN}") - if [ ! "$CCI_FOLLOW_RESPONSE" = "200" ] - then - echo - echo "Unable to follow the project" - echo - exit 1 - else - printf "\e[32mProject added to CircleCI\e[0m\n" - fi -} \ No newline at end of file diff --git a/_init/_gitSetup.sh b/_init/_gitSetup.sh deleted file mode 100755 index 6b67ac5..0000000 --- a/_init/_gitSetup.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -_gitSetup() { - echo "Initializing local git repo" - echo - sleep 1 - git init - git remote add origin git@github.com:"$CCI_ORGANIZATION"/"$CCI_REPO".git - git add . - git commit -m "initial commit" - echo - sleep 1 - echo "Pushing initial configuration to setup project on CircleCI" - sleep 1 - echo - git push -u origin master - sleep 1 -} \ No newline at end of file diff --git a/_init/_installCLI.sh b/_init/_installCLI.sh deleted file mode 100755 index 3ea1055..0000000 --- a/_init/_installCLI.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash -_installCLI() { - if [ -x "$(command -v circleci)" ]; then - echo "circleci cli already installed" - circleci setup - echo "setting token internally" - CLI_FILE_PATH=$(circleci diagnostic | grep "Config found:" | awk '{print $3}') - else - echo "circleci cli not installed" - curl -fLSs https://circle.ci/cli | sudo bash && circleci setup - sleep 1 - echo - echo "setting token internally" - CLI_FILE_PATH="$HOME/.circleci/cli.yml" - fi - - echo "$CLI_FILE_PATH" - CCI_TOKEN=$(awk '/token:/ {print $2}' "$CLI_FILE_PATH") -} diff --git a/_init/_orbSetup.sh b/_init/_orbSetup.sh deleted file mode 100755 index 300c7b8..0000000 --- a/_init/_orbSetup.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash -_orbSetup() { - printf "\e[1mSelect your Orb namespace. Each organization/user may claim one unique namespace.\e[0m\n" - echo "You may see an error if you have already previously claimed this namespace. This can safely be ignored for now." - echo - sleep 2 - read -p "Enter Namespace: " -r CCI_NAMESPACE - echo - if [ -z "$CCI_NAMESPACE" ] - then - echo - echo "Namespace missing. Try again" - _orbSetup - fi - sleep 1 - circleci namespace create "$CCI_NAMESPACE" github "$CCI_ORGANIZATION" - sleep 1 - echo - printf "\e[1mSelect your Orb Name. Your Orb will live at ${CCI_NAMESPACE}/\e[96m{ORB NAME}\e[0m\n" - read -p "Enter Orb Name: " -r CCI_ORBNAME - echo - sleep 1 - echo "Orb ${CCI_NAMESPACE}/${CCI_ORBNAME} selected" - echo "Creating Orb" - sleep 2 - echo - circleci orb create "${CCI_NAMESPACE}/${CCI_ORBNAME}" - echo - sleep 1 -} \ No newline at end of file diff --git a/_init/_setCreateRepo.sh b/_init/_setCreateRepo.sh deleted file mode 100755 index ada8c64..0000000 --- a/_init/_setCreateRepo.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash -_setCreateRepo() { - # set org type for API string - if [ "$REPO_TYPE" = "Personal" ]; then - REPO_TYPE="user" - else - REPO_TYPE="orgs/$CCI_ORGANIZATION" - fi - GIT_REPO_CREATE_RES=$(curl -u "$CCI_ORGANIZATION":"$CCI_GH_TOKEN" --silent --write-out "HTTPSTATUS:%{http_code}" "https://api.github.com/$REPO_TYPE/repos" -X POST --header "Content-Type: application/json" -d '{"name":"'"$CCI_REPO"'","read_only":false}') - GIT_RES_BODY=$(echo "$GIT_REPO_CREATE_RES" | sed -e 's/HTTPSTATUS\:.*//g') - GIT_RES_STATUS=$(echo "$GIT_REPO_CREATE_RES" | tr -d '\n' | sed -e 's/.*HTTPSTATUS://') - if [ "$GIT_RES_STATUS" == "201" ] - then - echo - echo "GitHub Repo created." - echo "https://github.com/$CCI_ORGANIZATION/$CCI_REPO" - echo "You will find your orb here shortly." - sleep 1 - echo - echo "continuing..." - sleep 2 - else - echo - printf "\e[91mError Creating Repo\e[0m\n" - echo "Unable to create the GitHub repo. Error reurned: $GIT_RES_STATUS" - echo - sleep 1 - echo "$GIT_RES_BODY" - exit 1 - fi -} \ No newline at end of file diff --git a/_init/_setGithubToken.sh b/_init/_setGithubToken.sh deleted file mode 100755 index 8ce3283..0000000 --- a/_init/_setGithubToken.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -_setGithubToken() { - echo "Create a GitHub Personal access token" - echo "The access token will be used to add a public key to your account automatically" - echo - sleep 1 - echo "Create your peronal access token here: https://github.com/settings/tokens" - sleep 3 - read -p "Enter GitHub Personal Access Token: " -r CCI_GH_TOKEN -} \ No newline at end of file diff --git a/_init/_textComplete.sh b/_init/_textComplete.sh deleted file mode 100755 index 157f60a..0000000 --- a/_init/_textComplete.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -_textComplete() { - echo - echo - echo - echo "-------------------" - printf "\e[1mCongratulations! The setup is complete.\e[0m\n" - echo "-------------------" - printf "Your orb currently lives at: \e[96m${CCI_NAMESPACE}\e[39m/\e[96m${CCI_ORBNAME}\e[39m@\e[92mdev:alpha\e[39m\n" - echo "You may see the current progress here: https://circleci.com/gh/$CCI_ORGANIZATION/workflows/$CCI_REPO" - echo "Begin to edit the files in the src directory to build your own orb." - echo "More information can be found in the readme" -} \ No newline at end of file diff --git a/_init/_textIntro.sh b/_init/_textIntro.sh deleted file mode 100755 index 369d788..0000000 --- a/_init/_textIntro.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash -_textIntro() { - echo - echo "-------------------" - printf "\e[38;5;45m\e[1mCircleCI Orb init\e[0m\n" - echo "-------------------" - echo - printf "\e[0mThis tool will help you create your first Orb with an automated build-test-deploy CircleCI Workflow.\n" - echo "Follow along with the readme: https://github.com/CircleCI-Public/orb-starter-kit" - sleep 2 - echo - printf "\e[1mInstalling CircleCI CLI\e[0m\n" - echo "This step will require SUDO to update the CLI" - echo -} \ No newline at end of file diff --git a/config.yml b/config.yml.bak similarity index 97% rename from config.yml rename to config.yml.bak index cb94e5d..f3da7d1 100755 --- a/config.yml +++ b/config.yml.bak @@ -4,7 +4,7 @@ version: 2.1 # release must exist; you'll need to publish manually at least once) # you can use scripts/publish-alpha.sh to publish a @dev:alpha release orbs: - : /@dev:alpha + fuzzit: fuzzitdev/fuzzit@dev:alpha orb-tools: circleci/orb-tools@8.27.3 workflows: @@ -26,7 +26,7 @@ workflows: # store CIRCLE_TOKEN as a project env var or Contexts resource # if using Contexts, add your context below - orb-tools/publish-dev: - orb-name: / + orb-name: fuzzitdev/fuzzit requires: - orb-tools/pack diff --git a/orb-init.sh b/orb-init.sh deleted file mode 100755 index 03e523c..0000000 --- a/orb-init.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -clear -# remove git folder in the event a user clones the repo -rm -rf .git -# Load in functions -for PARTIAL in ./_init/*.sh; do - . "$PARTIAL" -done -_textIntro -sleep 1 -_installCLI -printf "\e[1mTesting authentication to GitHub.com\e[0m\n" -_checkGithubAuth -_setGithubToken -printf "\e[1mBegin Orb Creation\e[0m\n" -echo -sleep 1 -_checkOrgName -_checkRepoName -_setCreateRepo -echo -_gitSetup -printf "\e[1mSwitching to Alpha branch\e[0m\n" -git checkout -b Alpha -echo -_orbSetup -echo -sleep 1 -printf "\e[1mAdding project to CircleCI\e[0m\n" -sleep 2 -_followProject -echo -sleep 1 -_CCIAddSecrets -_editConfig -sleep 1 -echo "Replacing config in .circleci/config.yml" -rm -rf .circleci/config.yml -mv config.yml .circleci -echo -echo "Producing development orb" -circleci config pack src > orb.yml -circleci orb publish orb.yml "${CCI_NAMESPACE}/${CCI_ORBNAME}@dev:alpha" -rm -rf orb.yml -echo "Commiting changes to Alpha branch" -git checkout -b Alpha -git add . -git commit -m "Setup complete" -git push -u origin Alpha -_textComplete -_cleanup diff --git a/src/@orb.yml b/src/@orb.yml index 5e5dd5f..5bcd86c 100755 --- a/src/@orb.yml +++ b/src/@orb.yml @@ -1,9 +1,4 @@ version: 2.1 description: > - Sample orb description - # What will your orb allow users to do? - # Descriptions should be short, simple, and clear. - -orbs: - hello: circleci/hello-build@0.0.5 # Sample imported orb + This orb uses Fuzzit.dev to integrate continuous fuzzing and regression into your CI. diff --git a/src/commands/download.yml b/src/commands/download.yml new file mode 100755 index 0000000..c288c2e --- /dev/null +++ b/src/commands/download.yml @@ -0,0 +1,15 @@ +description: > + this will download fuzzit cli for a given OS. +parameters: + os: + type: enum + default: "Linux" + enum: ["Linux", "Darwin", "Windows"] + description: The OS in which this command is run to download the appropriate fuzzit cli. +steps: + - run: + name: Download Fuzzit CLI + command: | + wget -O fuzzit https://github.com/fuzzitdev/fuzzit/releases/latest/download/fuzzit_<>_x86_64 + chmod a+x fuzzit + sudo mv fuzzit /usr/local/bin/fuzzit diff --git a/src/commands/fuzzing.yml b/src/commands/fuzzing.yml new file mode 100755 index 0000000..0f159c3 --- /dev/null +++ b/src/commands/fuzzing.yml @@ -0,0 +1,7 @@ +description: > + this will run fuzzit.sh script with fuzzing as the first argument. +steps: + - download + - run: + name: Run fuzzing (submit fuzzers to fuzzit.dev) + command: ./fuzzit.sh fuzzing diff --git a/src/commands/greet.yml b/src/commands/greet.yml deleted file mode 100755 index 1cadce5..0000000 --- a/src/commands/greet.yml +++ /dev/null @@ -1,14 +0,0 @@ -# How to author commands: https://circleci.com/docs/2.0/reusing-config/#authoring-reusable-commands -description: > - Replace this text with a description for this command. - # What will this command do? - # Descriptions should be short, simple, and clear. -parameters: - greeting: - type: string - default: "Hello" - description: "Select a proper greeting" -steps: - - run: - name: Hello World - command: echo << parameters.greeting >> world diff --git a/src/commands/local-regression.yml b/src/commands/local-regression.yml new file mode 100755 index 0000000..2abb381 --- /dev/null +++ b/src/commands/local-regression.yml @@ -0,0 +1,7 @@ +description: > + this will run fuzzit.sh script with local-regression as the first argument. +steps: + - download + - run: + name: Run local fuzzing regression + command: ./fuzzit.sh local-regression diff --git a/src/examples/example.yml b/src/examples/example.yml deleted file mode 100755 index d7b7979..0000000 --- a/src/examples/example.yml +++ /dev/null @@ -1,14 +0,0 @@ -description: > - Sample example description. - # What will this example document? - # Descriptions should be short, simple, and clear. -usage: - version: 2.1 - orbs: - foo: bar/foo@1.2.3 - jobs: - build: - machine: true - steps: - - foo/hello: - username: "Anna" diff --git a/src/executors/default.yml b/src/executors/default.yml deleted file mode 100755 index e883aa0..0000000 --- a/src/executors/default.yml +++ /dev/null @@ -1,14 +0,0 @@ -# How to author Executors: https://circleci.com/docs/2.0/reusing-config/#authoring-reusable-executors -description: > - This is a sample executor using Docker and Node. - # What is this executor? - # Descriptions should be short, simple, and clear. -docker: - - image: 'circleci/node:<>' -parameters: - tag: - default: latest - description: > - Pick a specific circleci/node image variant: - https://hub.docker.com/r/circleci/node/tags - type: string diff --git a/src/jobs/hello.yml b/src/jobs/hello.yml deleted file mode 100755 index 4af933d..0000000 --- a/src/jobs/hello.yml +++ /dev/null @@ -1,13 +0,0 @@ -description: > - # What will this job do? - # Descriptions should be short, simple, and clear. - Sample description -executor: default -parameters: - greeting: - type: string - default: "Hello" - description: "Select a proper greeting" -steps: - - greet: - greeting: << parameters.greeting >>