StackStorm / StackStorm/st2

pack install git ref error in st2packs docker build

Open
#4,629 14 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement logging
Dominant language
Python
Stars
6.5k
Forks
787
PR merge metrics
No merged PRs in 30d

Description

SUMMARY

Using the st2 pack install from st2common/util/pack_management.py in the st2packs docker builder, an error condition on getting branch name can occur.

ISSUE TYPE

Pick one below and delete the rest:

  • Bug Report
STACKSTORM VERSION

st2packs base
https://github.com/StackStorm/st2packs-dockerfiles

OS / ENVIRONMENT / INSTALL METHOD

Docker - st2packs docker builder
https://github.com/StackStorm/st2packs-dockerfiles

STEPS TO REPRODUCE

To reproduce, we use a CI job to build packs for changes on master, tags, and certain branches, e.g. release.

The CI will checkout the release branch, and then the Docker file will run copying the pack files into the container and attempting to install:

FROM myregistry/st2/base:v1.0.0 AS builder

COPY . /opt/stackstorm/packs/my-pack

RUN /opt/stackstorm/st2/bin/st2-pack-install /opt/stackstorm/packs/my-pack

Now we did realize now that we should be using st2-pack-install with a file prefix, e.g. st2-pack-install file:///opt/my-pack

However, the above Dockerfile process has worked for master and tags, just not this release branch

EXPECTED RESULTS

pack to install with git ref of a branch or for this to error out on all git ref's

ACTUAL RESULTS

errors

 File "/opt/stackstorm/st2/lib/python2.7/site-packages/st2common/util/pack_management.py", line 119, in download_pack
    ref=pack_version)
  File "/opt/stackstorm/st2/lib/python2.7/site-packages/st2common/util/pack_management.py", line 163, in clone_repo
    raise e
TypeError: HEAD is a detached symbolic reference as it points to 'dd4047d9816aa31f5d65df56b1cd420c2dff3add'
The command '/bin/sh -c /opt/stackstorm/st2/bin/st2-pack-install /opt/stackstorm/packs/foo' returned a non-zero code: 1

Contributor guide

Open the contributing guide

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 in st2common/util/pack_management.py, especially download_pack and clone_repo, and reproduce the failure with the st2-pack-install command shown in the Docker build. Trace how the checked-out release branch and pack_version are handled when HEAD is detached. Done means the documented branch-ref case installs successfully, or the command reports the same clear error for unsupported refs.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, python
Domain
devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.