Giter Club home page Giter Club logo

composer-push's Issues

Cannot push because of "cURL: 60 SSL" error.

I did a push, but it is returning an error:

[GuzzleHttp\Exception\RequestException]                                                                                                                               
  cURL error 60: SSL certificate problem: self signed certificate (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://nexus.(...)

Include "config" in composer.json, but apparently it had no effect

 "config": {
        "secure-https":false
    },

What can I do?

Type not set from original composer.json

Hello,

I wanted to use nexus composer to serve up my packages, but the type field doesn't seem to be carried into the repository from the composer.json.

I want to use laravel-module-installer and it requires that the type be laravel-module, but when I use this package to push to the reposity I get something like this instead:

{"packages":{"shemgp/theme-module":{"0.0.1":{"name":"shemgp/theme-module","version":"0.0.1","dist":{"url":"https://development.aiias.edu:8081/repository/aiias/shemgp/theme-module/0.0.1/shemgp-theme-module-0.0.1.zip","type":"zip","reference":"4c7335550b1b790cd38d5ef4a028be9c08e72c23","shasum":"4c7335550b1b790cd38d5ef4a028be9c08e72c23"},"time":"2018-12-10T00:35:56+00:00","uid":3250053404},"0.0.2":{"name":"shemgp/theme-module","version":"0.0.2","dist":{"url":"https://development.aiias.edu:8081/repository/aiias/shemgp/theme-module/0.0.2/shemgp-theme-module-0.0.2.zip","type":"zip","reference":"86f1f72da40be3155f66558bdf8f2be85f29161d","shasum":"86f1f72da40be3155f66558bdf8f2be85f29161d"},"time":"2018-12-10T08:42:21+00:00","uid":1381738723}}}}

As you can see, the type is zip in the dist but there's no type in the child fields of the version number so composer uses the default, which is library.

Thank you for your help.

composer extra nexus-push ignores are not read correctly

When creating the zip archive, the ignores are read from $this->nexusPushConfig before the config is loaded into that variable. So no files get ignored.

Same goes for reading the "ignore-by-git-attributes" option from composer extra.

Support Symfony 6.0

Symfony 6 is only supported in friendsofphp/php-cs-fixer 3.4.0, 3.4.0 does not support Symfony 3 (This library does). Additionally friendsofphp/php-cs-fixer 3.5.0 drops Symfony 4. Determination is this library should be on friendsofphp/php-cs-fixer 3.5.0.

However! friendsofphp/php-cs-fixer 3.5.0 requires composer/xdebug-handler 3.0.1 but composer/composer 2.2.6 (Latest) itself does not currently require composer/xdebug-handler 3.0.1 (its in main but not in a release yet) thus the two packages are incompatible at this time. Until composer/composer main branch gets tagged in a release.

I was able to find a compatible set of requirements without having to wait for composer/composer

See #63

Plugin produces Deprecation Messages in Progress Bar

We recently switched to elendev/composer-push:^1.0 when we updated to a recent Version of Composer. Ever since we see deprecation Messages (produces by the Progress Bar I think).

We're running PHP 8.1, Composer 2.3.7 & elendev/composer-push 1.0.3.

Not a big problem, but I was wondering why this would need a Progress Bar to push (in our case) a couple of hundred kilobytes to a registry ..

Pushing archive to URL: https://artifactory.REDACTED...
   0/100 [>---------------------------]   0%
Deprecation Notice: Implicit conversion from float 12.218454086645576 to int loses precision in phar:///usr/local/bin/composer/vendor/symfony/console/Helper/ProgressBar.php:346
Deprecation Notice: Implicit conversion from float 12.218454086645576 to int loses precision in phar:///usr/local/bin/composer/vendor/symfony/console/Helper/ProgressBar.php:346
Deprecation Notice: Implicit conversion from float 24.43690817329115 to int loses precision in phar:///usr/local/bin/composer/vendor/symfony/console/Helper/ProgressBar.php:346
Deprecation Notice: Implicit conversion from float 24.43690817329115 to int loses precision in phar:///usr/local/bin/composer/vendor/symfony/console/Helper/ProgressBar.php:346
Deprecation Notice: Implicit conversion from float 36.65536225993672 to int loses precision in phar:///usr/local/bin/composer/vendor/symfony/console/Helper/ProgressBar.php:346
Deprecation Notice: Implicit conversion from float 36.65536225993672 to int loses precision in phar:///usr/local/bin/composer/vendor/symfony/console/Helper/ProgressBar.php:346
Deprecation Notice: Implicit conversion from float 48.8738163465823 to int loses precision in phar:///usr/local/bin/composer/vendor/symfony/console/Helper/ProgressBar.php:346
Deprecation Notice: Implicit conversion from float 48.8738163465823 to int loses precision in phar:///usr/local/bin/composer/vendor/symfony/console/Helper/ProgressBar.php:346
Deprecation Notice: Implicit conversion from float 61.09227043322787 to int loses precision in phar:///usr/local/bin/composer/vendor/symfony/console/Helper/ProgressBar.php:346
Deprecation Notice: Implicit conversion from float 61.09227043322787 to int loses precision in phar:///usr/local/bin/composer/vendor/symfony/console/Helper/ProgressBar.php:346
Deprecation Notice: Implicit conversion from float 73.31072451987345 to int loses precision in phar:///usr/local/bin/composer/vendor/symfony/console/Helper/ProgressBar.php:346
Deprecation Notice: Implicit conversion from float 73.31072451987345 to int loses precision in phar:///usr/local/bin/composer/vendor/symfony/console/Helper/ProgressBar.php:346
Deprecation Notice: Implicit conversion from float 85.52917860651903 to int loses precision in phar:///usr/local/bin/composer/vendor/symfony/console/Helper/ProgressBar.php:346
Deprecation Notice: Implicit conversion from float 85.52917860651903 to int loses precision in phar:///usr/local/bin/composer/vendor/symfony/console/Helper/ProgressBar.php:346
Deprecation Notice: Implicit conversion from float 97.7476326931646 to int loses precision in phar:///usr/local/bin/composer/vendor/symfony/console/Helper/ProgressBar.php:346
Deprecation Notice: Implicit conversion from float 97.7476326931646 to int loses precision in phar:///usr/local/bin/composer/vendor/symfony/console/Helper/ProgressBar.php:346

Ignoring paths does not work like that

https://github.com/Elendev/nexus-composer-push/blob/9dc7d473eb0f28adb5caf829575b90d3010a59af/src/ZipArchiver.php#L48-L50

These lines are not necessary and also wrong.

The Finder internally evaluates if we want to ignore VCS paths and adds the paths to ignore here: https://github.com/symfony/finder/blob/v4.4.4/Finder.php#L702

If you loop through the files, you are ignoring basically EVERYTHING and that by accident, too.
This is because you are passing a file object to the Finder::notPath() method, which gets converted to an array. The conversion works, but the output is not what Finder::notPath() excepts.

So basically you are ignoring random paths.

Just remove the loop completely and you should be good to go ;)

[Enhancement] Make the <version> cli parameter optional

Hello,

please make the cli parameter optional, because the version information are already in the composer.json file.
At the moment it is possible for example to push the version 1.0.0 with the cli-version 2.0.0 this is ambiguous and irritating.

Thx
Roland

'Require Guzzle Functions Manually' is broken

The code is (taking just one example):

    $guzzlepromisesfunctions = $composer->getConfig()->get('home') . '/vendor/guzzlehttp/promises/src/functions_include.php';
    if (!file_exists($guzzlepromisesfunctions)) {
        throw new FileNotFoundException("guzzlehttp/promises/src/functions.php not found, is guzzle installed?");
    }

Firstly, it's checking for functions_include.php and then saying functions.php is missing, and secondly $composer->getConfig()->get('home') returns the $HOME directory - eg /home/fred.

Misleading error message when https:// is not specified in target URL

Steps to reproduce

docker run -it --user root:root --rm --init -v `pwd`:`pwd` -w `pwd` skilldlabs/php:74-fpm /bin/ash
composer global require elendev/composer-push --no-interaction
composer global config --no-plugins allow-plugins.elendev/composer-push true

Observed

composer push --url=repositories.XXX.com/repository/XXXX/ --username=XXXX --password="XXXX" 1.0.22

Returns error:

Pushing archive to URL: repositories.XXX.com/repository/XXX/packages/upload/XXX/formatter_video_popup/1.0.22...
  100 [============================]

                                                                                                                                                                                              
  [GuzzleHttp\Exception\RequestException]                                                                                                                                                     
  cURL error 18: transfer closed with outstanding read data remaining (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://repositories.XXX.com/repository/XXXX/packages/upload/XXXX/formatter_video_popup/1.0.22                                                                                                                            
                                                                                                                                                                                              

push [--name NAME] [--url URL] [--type TYPE] [--repository REPOSITORY] [--username USERNAME] [--password PASSWORD] [-i|--ignore [IGNORE]] [--ignore-dirs [IGNORE-DIRS]] [--ignore-by-git-attributes] [--ignore-by-composer] [--src-type SRC-TYPE] [--src-url SRC-URL] [--src-ref SRC-REF] [--keep-vendor] [--keep-dot-files] [--ssl-verify [SSL-VERIFY]] [--access-token [ACCESS-TOKEN]] [--] [<version>]

Whereas

composer push --url=https://repositories.XXX.com/repository/XXXX/ --username=XXXX --password="XXXX" 1.0.22

Returns success:

Pushing archive to URL: https://repositories.XXX.com/repository/XXXpackages/upload/XXX/formatter_video_popup/1.0.22...
  100 [============================]
Archive correctly pushed to the Nexus server

Expected

  • If composer push command requires full URL (protocol + URI), command should fail by throwing an appropriate error message instead of displaying cURL error message

How include vendor folder ?

Hello,
Thanks a lot for your composer-push tool.
I try to use your plugin to upload our Drupal binary on Nexus.
It is not a composer package but a web application that is "build" with composer.
Is there an option to include a specific folder (eg /vendor/) in the archive ?

Thanks,
Romain

credentials via auth.json

When i use my nexus to access a hosted authorization-required repository, the update already asks for the credentials so i set it up.
composer update

Loading composer repositories with package information
Warning: Accessing 192.168.56.2 over http which is an insecure protocol.
                                                                        
    Authentication required (192.168.56.2):
      Username: user
      Password: 
Do you want to store credentials for 192.168.56.2 in /home/user/.composer/auth.json ? [Yn] Y

But when i try to push to the same repository with your tool the auth fails, although i did expect it to be picked up from the auth.json (according to your documentation).
composer nexus-push master

[ZIP Archive] Archive into the subdirectory user-something-master
Zip archive /tmp/nexus-pushF2CG0m.zip done
Execute the Nexus Push for the URL http://192.168.56.2:8081/repository/packagist-private/packages/upload/user/something/master...
A network error occured while trying to upload to nexus: Client error: `PUT http://192.168.56.2:8081/repository/packagist-private/packages/upload/user/something/master` resulted in a `401 Unauthorized` response

In PushCommand.php line 275:

  Impossible to push to remote repository, use -vvv to have more details  

I figured out that your regex may try to search for the port too, so i cloned the block and added it.
cat ~/.composer/auth.json

{
    "http-basic": {
        "192.168.56.2": {
            "username": "user",
            "password": "*******"
        },
        "192.168.56.2:8081": {
            "username": "user",
            "password": "*******"
        }
    }
}

Lo and behold it works.

Update needed to support composer 2.3.2

Hello and thanks for this helpful module !

When updating composer from version 2.2.10 to 2.3.2, I get the following error on package push:

Execute the push for the URL https://<nexus>/repository/composer-twd/packages/upload/twd/<package>
Archive correctly pushed to the Nexus server

In Command.php line 301:
                                                                               
  [TypeError]                                                                  
  Return value of "Elendev\ComposerPush\PushCommand::execute()" must be of th  
  e type int, "null" returned.                                                 
                                                                               

Exception trace:
  at phar:///usr/local/bin/composer/vendor/symfony/console/Command/Command.php:301
 Symfony\Component\Console\Command\Command->run() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:1015
 Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:299
 Symfony\Component\Console\Application->doRun() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:334
 Composer\Console\Application->doRun() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:171
 Symfony\Component\Console\Application->run() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:130
 Composer\Console\Application->run() at phar:///usr/local/bin/composer/bin/composer:83
 require() at /usr/local/bin/composer:29

push [--name NAME] [--url URL] [--type TYPE] [--repository REPOSITORY] [--username USERNAME] [--password PASSWORD] [-i|--ignore [IGNORE]] [--ignore-dirs [IGNORE-DIRS]] [--ignore-by-git-attributes] [--ignore-by-composer] [--src-type SRC-TYPE] [--src-url SRC-URL] [--src-ref SRC-REF] [--keep-vendor] [--keep-dot-files] [--ssl-verify [SSL-VERIFY]] [--access-token [ACCESS-TOKEN]] [--] [<version>]

Can you help wityh this ?
Best regards

Error with updating assets

I am trying to set up the package "ourcompany/project" in our own nexus repository, using composer-push. We have versions based on commit hashes already, that works nicely, and now I want to additionally always push a "latest" version (so that it can be used in test pipelines). Here I get the following error message:

Pushing archive to URL: https://nexus.ourcompany.com/repository/composer-ourcompany/packages/upload/ourcompany/project/latest...
                                                                                                                                                                                                         
  [GuzzleHttp\Exception\ClientException]                                                                                                                                                                 
  Client error: `PUT https://nexus.ourcompany.com/repository/composer-ourcompany/packages/upload/ourcompany/project/latest` resulted in a `400 Repository does not allow updating assets: composer-ourcompany` response  
                                                                                                                                                                                                         
push [--name NAME] [--url URL] [--type TYPE] [--repository REPOSITORY] [--username USERNAME] [--password PASSWORD] [-i|--ignore [IGNORE]] [--ignore-dirs [IGNORE-DIRS]] [--ignore-by-git-attributes] [--ignore-by-composer] [--src-type SRC-TYPE] [--src-url SRC-URL] [--src-ref SRC-REF] [--keep-vendor] [--keep-dot-files] [--ssl-verify [SSL-VERIFY]] [--access-token [ACCESS-TOKEN]] [--] [<version>]

Can composer-push be configured to force overriding the existing version name? If not, are there other ways of always getting the latest version of a package?

Cannot push because of unlink error exception

Hello There,

I am unable to push artefacts to Nexus, when running composer nexus-push 1.0.0 -vvv
The error logs has the following messages ( with verbose mode ) :

Reading ./composer.json
Loading config file ./composer.json
Loading config file /home/user/Desktop/random-password/auth.json
Reading /home/user/Desktop/random-password/auth.json
Checked CA file /etc/ssl/certs/ca-certificates.crt: valid
Failed to initialize global composer: Composer could not find the config file: /home/user/.config/composer/composer.json
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section
Reading /home/user/Desktop/random-password/vendor/composer/installed.json
Loading plugin Elendev\NexusComposerPush\Plugin
Running 2.0.4 (2020-10-30 22:39:11) with PHP 7.4.12 on Linux / 5.4.0-52-generic
Ignore directories: .gitattributes .gitignore phpunit.xml  README.md vendor/
Execute the Nexus Push for the URL https://localhost:8081/repository/composer-test-1/packages/upload/mazraara/random-password/1.0.0...
[postFile] Trying credentials auth.json
Remove file /tmp/nexus-pushJ3zfJM.zip

                                                                
  [ErrorException]                                              
  unlink(/tmp/nexus-pushJ3zfJM.zip): No such file or directory  
...
...

 [ErrorException]                                                                    
  fopen(/tmp/nexus-pushJ3zfJM.zip): failed to open stream: No such file or directory  
                                                                

When I check the /tmp folder I only see the name without the extension :
-rw------- 1 user user 0 Nov 3 12:55 nexus-pushJ3zfJM

so probably there is some issue when Zipping the actual directory.

Note: I can still push using curl cmdline.

version cli

maybe the version param on cli should default to latest ?

Optional parameters to add the source tag in the composer package json

In composer package json file you can have a source tag which can contain type, url and reference which is quiet good to have these for the reference of a code source in a version control to the current package in the repository.
Maybe adding a src-url, src-type, src-ref would be a good idea as optional values.
Of course this part needs the composer repository of nexus to be compatible as well.
sonatype-nexus-community/nexus-repository-composer#55
This issue in the repository has been addressed via a Pull Request as well.
For the compatibility with this feature, which will have a Pull Request shortly.
Thanks in advance.

Make compatible with composer 2

  • elendev/nexus-composer-push 0.2.2 requires composer-plugin-api ^1.1 -> found composer-plugin-api[2.0.0] but it does not match the constraint.

What are the plans to make this compatible with composer 2?

package sources should be in a folder in the zip file instead of being in root

Hi @Elendev.

Zip files generated by this package before being sent to Nexus Repository have files directly stored at root path.

It seems that packages from packagist (composer public repository) have a root folder in the zip file.

here what happens with dependency while composer install or update from Nexus then:

Package operations: 101 installs, 0 updates, 0 removals
  - Installing cooperl/laravel-monitoring (0.0.1): Downloading (100%)
    Failed to execute unzip -qq  '/home/************/vendor/************/laravel-monitoring/9f4e0aea62e010dcfa22cf6199eb91d3.zip' -d '/home/************/vendor/composer/81d64773'

warning:  stripped absolute path spec from /composer.json
warning:  stripped absolute path spec from /src/LumenServiceProvider.php
warning:  stripped absolute path spec from /src/Contracts/Monitorer.php
warning:  stripped absolute path spec from /src/MonitoringLog.php
warning:  stripped absolute path spec from /src/Monitorer.php
warning:  stripped absolute path spec from /src/ServiceProvider.php
warning:  stripped absolute path spec from /src/Concerns/Monitorable.php
warning:  stripped absolute path spec from /src/Middleware/Monitore.php
warning:  stripped absolute path spec from /LICENSE.md
warning:  stripped absolute path spec from /config/monitoring.php
warning:  stripped absolute path spec from /README.md

    The archive may contain identical file names with different capitalization (which fails on case insensitive filesystems)
    Unzip with unzip command failed, falling back to ZipArchive class

Best regards,

`No such file or directory` error during push

Attempting to perform composer push command on windows 11 with php 8.3.4 causes following error:

***> composer push                          

In PushCommand.php line 159:
                                                                                             
  unlink(***\AppData\Local\Temp\comA3FA.tmp.zip): No such file or directory  
                                                                                             

In ZipArchiver.php line 93:
                                             
  ZipArchive::close(): Read error: No error  
                                             

push [--name NAME] [--url URL] [--type TYPE] [--repository REPOSITORY] [--username USERNAME] [--password PASSWORD] [-i|--ignore [IGNORE]] [--ignore-dirs [IGNORE-DIRS]] [--ignore-by-git-attributes] [--ignore-by-composer] [--src-type SRC-TYPE] [--src-url SRC-URL] [--src-ref SRC-REF] [--keep-vendor] [--keep-dot-files] [--ssl-verify [SSL-VERIFY]] [--access-token [ACCESS-TOKEN]] [--] [<version>]

Dependency version is 1.0.4, composer config related to plugin is following:

{
    "require-dev": {
        "elendev/composer-push": "^1.0"
    },
    "extra": {
        "push": {
            "url": "***",
            "type": "nexus",
            "ssl-verify": true,
            "ignore-by-git-attributes": true
        }
    },
    "config": {
        "allow-plugins": {
            "elendev/composer-push": true
        }
    },
}

install as global plugin

Hello

is it possible to install is as global plugin? I tried but when I then try to push a package I have a
Fatal error: Uncaught Error: Call to undefined function GuzzleHttp\choose_handler()

Best

kikkauz

Full support of Artifactory tokens

It's currently possible to use tokens to connect to Artifactory, by providing them as password.

It's not currently possible to use tokens as standalone authentication mechanism without having to provide a username.

Add support for standalone artifactory tokens.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.