0

I've just started setting up a Github-actions workflow for one of project.I attempted to run the workflow steps inside a container with this workflow definition:

  name: TMT-Charts-CI

  on:
    push:
      branches:
        - master
        - actions-ci

  jobs:
    build:
      runs-on: ubuntu-latest
      container:
        image: docker://alpine/helm:2.13.0

      steps:
      - name: Checkout Code
        uses: actions/checkout@v1

      - name: Validate and Upload Chart to Chart Museum
        run: |
          echo "Hello, world!"
          export PAGER=$(git diff-tree --no-commit-id --name-only -r HEAD)
          echo "Changed Components are  => $PAGER"
          export COMPONENT="NOTSET"
          for CHANGE in $PAGER; do ENV_DIR=${CHANGE%%/*}; done
          for CHANGE in $PAGER; do if [[ "$CHANGE" != .* ]] && [[ "$ENV_DIR" == "${CHANGE%%/*}" ]]; then export COMPONENT="$CHANGE"; elif [[ "$CHANGE" == .* ]]; then echo "Not a Valid Dir for Helm Chart" ; else echo "Only one component per PR should be changed" && exit 1; fi; done
          if [ "$COMPONENT" == "NOTSET" ]; then echo "No component is changed!" && exit 1;  fi
          echo "Initializing Component => $COMPONENT"
          echo $COMPONENT | cut -f1 -d"/"
          export COMPONENT_DIR="${COMPONENT%%/*}"
          echo "Changed Dir => $COMPONENT_DIR"
          cd $COMPONENT_DIR
          echo "Install Helm and Upload Chart If Exists"
          curl -L https://git.io/get_helm.sh | bash
          helm init --client-only

But Workflow fails stating the container stopped due immediately.

Error Description

I have tried many images including "alpine:3.8" image described in official documentation, but container stops.

According to Workflow syntax for GitHub Actions, in the Container section: "A container to run any steps in a job that don't already specify a container." My assumption is that the container would be started and the steps would be run inside the Docker container.

9
  • Container is stopped or can't start. Seem there is no image docker://alpine/helm:2.13.0 to pull and start it Commented Aug 28, 2019 at 14:09
  • Image is pulled and container starts for once, but then stops immediately Commented Aug 28, 2019 at 14:13
  • It picks image from dockerhub Commented Aug 28, 2019 at 14:13
  • I just try to pull your container.Then I get this docker pull docker://alpine/helm:2.13.0 invalid reference format Commented Aug 28, 2019 at 14:15
  • Seem github can't pull your image and start it. If you get this image from dockerhub, and it public, why I can't pull it ? And image name clearly invalid format Commented Aug 28, 2019 at 14:15

1 Answer 1

1

We can achieve this my making custom docker images, Actually Github runners somehow stops the running container after executing the entrypoint command, I made docker image with entrypoint the make container alive, so container doesn't die after start.

Here is the custom Dockerfile (https://github.com/rizwan937/Helm-Image) You can publish this image to dockerhub and use it in workflow file like

 container:
   image: docker://rizwan937/helm

You can add this entrypoint to any docker image so that It remains alive for further steps execution.

This is a temporary solution, if anyone have better one, let me know.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.