Giter VIP home page Giter VIP logo

task-containers's People

Contributors

anandxkumar avatar aneesh-m-bhat avatar dependabot[bot] avatar otaviof avatar senjuti256 avatar vdemeester avatar

Watchers

 avatar

task-containers's Issues

Builder Image Scripts Directory Location

Certain s2i builder-images need a alternative location for the workflow scripts, i.e.:

$ s2i build --help |grep image-scripts-url
      --image-scripts-url string         Specify a URL containing the default assemble and run scripts for the builder image (default "image:///usr/libexec/s2i")

The s2i Tasks rendered by this project should as well support this configuration accordingly, like for instance an additional param.

S2I setup doesn't work for Java and .NET

The template being followed in the repository doesn't work for Java and .NET repositories. Checked it with all sorts of base builder images certified by Red Hat.

Task(s) should rely on Red Hat supported images

The task(s) we publish from here should rely on Red Hat supported images, aka from registry.redhat.io (and worse case from a trusted quay.io organization).

As of today, we rely on docker.io/library/bash, which we should probably change to use ubi directly.

Build Context Location (`SUBDIRECTORY` param)

Source-to-Image (s2i) supports a alternative directory to narrow down the container build context, relative to the source code repository root. Here supported by passing the SUBDIRECTORY param location to the s2i build command:

phase "Generating the Containerfile for S2I builder image '${PARAMS_BUILDER_IMAGE}'"
s2i --loglevel "${S2I_LOGLEVEL}" \
build "${PARAMS_SUBDIRECTORY}" "${PARAMS_BUILDER_IMAGE}" \
--as-dockerfile "${S2I_CONTAINERFILE_PATH}"

The tool copies the context data to the same directory where the Containerfile (Dockerfile.gen) is generated, and later runs the following COPY directive:

# Copying in source code
COPY upload/src /tmp/src

However, buildah uses the same SUBDIRECTORY param to define the build context based on source Workspace, which is no longer the desired working directory for s2i workflow causing buildah-bud.sh to fail [0]:

phase "Inspecting context subdirectory '${PARAMS_SUBDIRECTORY}'"
[[ ! -d "${PARAMS_SUBDIRECTORY}" ]] &&
fail "SUBDIRECTORY param is not found at '${PARAMS_SUBDIRECTORY}', on source workspace"

Thus, s2i-build.sh script must intercept the PARAMS_SUBDIRECTORY environment variable to ensure it's always set to . (current working directory) before loading buildah-common.sh, i.e.:

# loading buildah settings overwritting the full path to the container file
declare -x CONTAINERFILE_PATH_FULL="${S2I_CONTAINERFILE_PATH}"

# setting the buildah context directory to the same location s2i copied over it's context data, the
# same directory where the "--as-dockerfile" is set
declare -x PARAMS_SUBDIRECTORY="."

source "${cur_dir}/buildah-common.sh"

[0] Additionally, the error message is misleading, instead, it should mention the ${PWD} because ${PARAMS_SUBDIRECTORY} is a relative location.

Environment Variables

The s2i build workflow supports setting environment variables:

$ s2i build --help |grep env
  -e, --env string                       Specify an single environment variable in NAME=VALUE format
  -E, --environment-file string          Specify the path to the file with environment

S2I Tasks rendered by this project should leverage the setting, like for instance on task-buildpacks repository ENV_VARS param.

A practical approach is receiving the params via STDIN and loop over the key-value pairs:

steps:
  - name: example
    args: [ "$(params.ENV_VARS[*])" ]

Then, on s2i-generate.sh script can loop over the arguments to store on a file, for instance:

for kv in "${@}"; do
    # ...
done

The set of key-value should be stored on a temporary location (/s2i-generate/s2i.env?), informed to s2i using --environment-file flag.

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.