Skip to content

python3-*-debian syntax error during TEST_ENABLED check #53

@rgschmitz1

Description

@rgschmitz1

My actions before raising this issue

faas build fails with tox error #44 seems like it may be related

Expected Behaviour

Dockerfiles using python:3.7-slim-buster base image should skip testing when TEST_ENABLED is specified as false.

Current Behaviour

The TEST_ENABLED check is throwing a syntax error due to syntax inconsistencies between alpine (busybox) and debian (dash) implementations of the default shell. This doesn't allow the use of bypassing the test using the --build-arg "TEST_ENABLED=false" flag as suggested in the documentation.

Step 27/35 : RUN if [ "$TEST_ENABLED" == "false" ]; then     echo "skipping tests";    else     eval "$TEST_COMMAND";     fi
 ---> Running in 05bb4ca63b94
/bin/sh: 1: [: false: unexpected operator

Possible Solution

I suggest replacing the double equal (==) in the Dockerfile templates with a single equal (=) to be more POSIX friendly, this worked for me in both alpine and debian versions of the python image.

RUN if [ "$TEST_ENABLED" = "false" ]; then \

Steps to Reproduce (for bugs)

  1. faas-cli template pull https://github.com/openfaas-incubator/python-flask-template
  2. faas-cli new --lang python3-http-debian hello-python
  3. faas-cli build -f hello-python.yml

Context

I'm a college student working on a capstone project involving deploying open-source cloud native applications in Kubernetes and doing a comparison against vendor specific solutions.

I'm using of-watchdog templates as a basis for my own custom functions and would love to contribute in any way I can.

Your Environment

  • FaaS-CLI version ( Full output from: faas-cli version ):
  ___                   _____           ____
 / _ \ _ __   ___ _ __ |  ___|_ _  __ _/ ___|
| | | | '_ \ / _ \ '_ \| |_ / _` |/ _` \___ \
| |_| | |_) |  __/ | | |  _| (_| | (_| |___) |
 \___/| .__/ \___|_| |_|_|  \__,_|\__,_|____/
      |_|

CLI:
 commit:  b1c09c0243f69990b6c81a17d7337f0fd23e7542
 version: 0.14.2
  • Docker version docker version (e.g. Docker 17.0.05 ):
Docker version 20.10.14, build a224086
  • Are you using Docker Swarm or Kubernetes (FaaS-netes)?
    Kubernetes

  • Operating System and version (e.g. Linux, Windows, MacOS):

NAME="Ubuntu"
VERSION="20.04.4 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.4 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
  • Code example or link to GitHub repo or gist to reproduce problem:
    shared output snippet in current behavior above, let me know if a more complete log is required

  • Other diagnostic information / logs from troubleshooting guide

Next steps

You may join Slack for community support.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions