composer / composer/satis

Satis chooses wrong dist URL for Gitlab projects

Open
#580 1 comment 6 reactions 0 assignees View on GitHub
bug
Dominant language
PHP
Stars
3.3k
Forks
530
Avg merge
6h 53m
Merged PRs (30d)
13

Description

**Describe the bug**
When pointing satis to a Gitlab repo, it chooses a dist url that mirrors the source url instead of finding the Gitlab Release and using the dist zip artifact.

**To Reproduce**
Make your `satis.json` look like this;
```
{
"repositories": [
{ "type": "vcs", "url": "git@gitlab.com:group-name/project-name.git" },
],
"require-all": true
}
```

Then run `satis build satis.json` and satis will create a packages.json that looks like this:

```
{
"packages": {
"group-name/project-name": {
"v1.0.1": {
"name": "group-name/project-name",
"version": "v1.0.1",
"version_normalized": "1.0.1.0",
"source": {
"type": "git",
"url": "git@gitlab.com:group-name/project-name.git",
"reference": "68da091ec3d6891e8519095a8066b28eb2261c20"
},
"dist": {
"type": "zip",
"url": "https://gitlab.com/api/v4/projects/group-name%2Fproject-name/repository/archive.zip?sha=68da091ec3d6891e8519095a8066b28eb2261c20",
"reference": "68da091ec3d6891e8519095a8066b28eb2261c20",
"shasum": ""
},
"require": {
"composer/installers": "v1.0.6"
},
"require-dev": {
"wp-coding-standards/wpcs": "^2.2"
},
"time": "2020-01-13T04:39:57+00:00",
"type": "wordpress-plugin"
}
}
}
```

**Expected behavior**

The dist is supposed to be a distributable build of my app, NOT the source code version stored in git. The dist version's scripts are minified, css is build from sass, and various other things have been optimized. The dist version is stored as a zip artifact referenced by the Gitlab Release.

The above dist.url is simply an API call to Gitlab to generate a zip of the files *as they appear within the git repo!*

I expected satis to use the carefully constructed zip distributable that's associated with the Release. In my case, the url points to a Gitlab-CI artifact:

```
"dist": {
"type": "zip",
"url": "https://gitlab.com/api/v4/projects/11301246/jobs/400678589/artifacts/project-name-1.0.1.zip",
"reference": "68da091ec3d6891e8519095a8066b28eb2261c20",
"shasum": ""
},
```

Contributor guide

Open the contributing guide

Research direction

Start with the `satis build satis.json` path for GitLab VCS repositories and trace how the `source` and `dist` entries are generated in `packages.json`. Compare the GitLab Release artifact URL described in the issue with the repository archive URL; done when builds select the intended release artifact rather than generating a source archive URL.

Written by the indexing model from the issue text.

Assessment

Tech stack
gitlab, php
Domain
backend, cli, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.