Git Product home page Git Product logo

commons's Introduction

Common material for toolchains

This repo is collecting a range of common scripts that can be leveraged in toolchains, pipelines. For instance, you can use one of the shell scripts in your own toolchains in different ways.

  1. Copy a script content in one of your pipeline job script.

  2. Fetch a script from the commons location, and source it from your pipeline job.

    `#!/bin/bash
    source <(curl -sSL "https://raw.githubusercontent.com/open-toolchain/commons/master/scripts/deploy_helm")`
  1. Copy a script inside your application code (in a /scripts subfolder), and source it from your pipeline job.
    `#!/bin/bash
    source ./scripts/deploy_helm`

You can even combine the two... use local scripts, or defer to remote one...

      # use script from app source control, or default to template script
      # use source command to run script to ensure env variables are set in current shell
      SCRIPT_FILE="scripts/build_image.sh"
      SCRIPT_URL="https://raw.githubusercontent.com/open-toolchain/simple-helm-toolchain/master/${SCRIPT_FILE}"
      if [ ! -f  ${SCRIPT_FILE} ]; then
        echo -e "No script found at ./${SCRIPT_FILE}, defaulting to ${SCRIPT_URL}"
        source <(curl -sSL ${SCRIPT_URL})
      else
        source "${SCRIPT_FILE}"
      fi`

Recommendations:

  1. Initially try to understand the script behavior, by inserting set -x at the top of the script, you'll get better insight into the script command executions.
  2. Prefer source over sh command to run a script, as it then runs in the parent shell environment. Thus allowing to export environment variables that can be consumed in subsequent jobs in the same stage.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.