ocurrent / ocurrent/obuilder

Obuilder_spec.run isn't translating to Dockerfile correctly

Open
#66 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
OCaml
Stars
67
Forks
19
PR merge metrics
No merged PRs in 30d

Description

Merely picking a recent build from opam-repo-ci.

This fragment from opam-repo-ci:

run ~cache ~network {|
        opam remove -y %s && opam %s%s %s
        res=$?
        test "$res" = 0 && exit 0
        if test "$res" = 60 && diff -q /usr/bin/opam /usr/bin/opam-2.0; then
          sudo ln -f /usr/bin/opam-2.1 /usr/bin/opam
          opam remove -y %s && opam install -vy%s %s%s
          exit 1
        fi
        test "$res" != 31 && exit 1
        export OPAMCLI=2.0
        build_dir=$(opam var prefix)/.opam-switch/build
        failed=$(ls "$build_dir")
        for pkg in $failed; do
          if opam show -f x-ci-accept-failures: "$pkg" | grep -qF "\"%s\""; then
            echo "A package failed and has been disabled for CI using the 'x-ci-accept-failures' field."
          fi
        done
        exit 1
      |}
      pkg (if upgrade_opam then "install -vy" else "depext -uivy") (if with_tests then "t" else "") pkg
      pkg (if with_tests then "t" else "") pkg (if with_tests then "" else " && opam reinstall -vyt "^pkg)
      (Variant.distribution variant)

is rendered:

RUN  \
    opam remove -y leveldb.1.3.0 && opam depext -uivy leveldb.1.3.0 \
    res=$? \
    test "$res" = 0 && exit 0 \
    if test "$res" = 60 && diff -q /usr/bin/opam /usr/bin/opam-2.0; then \
    sudo ln -f /usr/bin/opam-2.1 /usr/bin/opam \
    opam remove -y leveldb.1.3.0 && opam install -vy leveldb.1.3.0 && opam reinstall -vyt leveldb.1.3.0 \
    exit 1 \
    fi \
    test "$res" != 31 && exit 1 \
    export OPAMCLI=2.0 \
    build_dir=$(opam var prefix)/.opam-switch/build \
    failed=$(ls "$build_dir") \
    for pkg in $failed; do \
    if opam show -f x-ci-accept-failures: "$pkg" | grep -qF "\"alpine-3.12\""; then \
    echo "A package failed and has been disabled for CI using the 'x-ci-accept-failures' field." \
    fi \
    done \
    exit 1 \
    

but it needs semi-colons at the end of most lines. Not sure if escaping is the answer or possibly invoking via a HERE document?!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at Obuilder_spec.run and reproduce the Dockerfile rendering using the opam-repo-ci fragment and rendered output in the issue. Trace how multiline run commands are translated, then verify that generated commands preserve the separators needed for the shell script to execute correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, ocaml
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.