apm-agent-php icon indicating copy to clipboard operation
apm-agent-php copied to clipboard

Release Agent API as a composer package

Open v1v opened this issue 5 years ago • 7 comments

This is regarding the requirements to be able to release a version for the apm-agent-php.

Requirements

  • Easy to release
  • CI should be orchestrator
  • Sensitive credentials should be stored in Vault
  • Release to https://packagist.org/
  • One script to be able to release independently of the CI, so if required it should be possible to release locally. composer with packagist.org
  • Tag event-based, when a particular tag release is created then the automation should do the same stages as done with PRs/Branches in addition to the release.

Actions

  • [ ] Release automation with composer
  • [x] Create user in packagist and store credentials in vault
  • [ ] Write down the release process in its RELEASING.md file
  • [ ] Automate the process in the pipeine

Prerequisites

  • The master build pipeline should be stable.

Questions

  • Does packagist support snapshot releases? In other words, if we would like to potentially publish the binary for every PR, is that something we can achieve with that service? We already have in place artifactory, so I could ask if they support the PHP central repo. This is required for the ongoing iniative of moving to CD.

v1v avatar Jan 14 '20 14:01 v1v

Credentials have been stored in secret/apm-team/ci/elastic-observability-packagist and the central secrets management service

v1v avatar Jul 07 '20 08:07 v1v

@v1v Should this be closed as a result of https://github.com/elastic/apm-agent-php/pull/122 being merged?

cachedout avatar Sep 16 '20 08:09 cachedout

@cachedout , this is something else about where to publish those artifacts to https://packagist.org/, I'll rename the issue title

v1v avatar Sep 16 '20 12:09 v1v

This is relevant only if we decide to support agent as a pure php library

v1v avatar Oct 07 '20 16:10 v1v

I think this is useful even without a pure php library. Whilst developing to add elastic APM to an existing codebase, I found it immensely helpful to install the PHP code (via composer + github) as a dev dependency, as my IDE was able to do code completion. Before I worked out to do this, I was reading the source code + documentation to work out how things should work, but it was much easier this way. I develop with docker, and the "real" library is installed under /opt/elastic in a docker image I've built, where my IDE cannot see it.

brettmc avatar Jun 30 '21 00:06 brettmc

I would like to bump this.

Having the PHP part, or even just the API part of the PHP part of the agent available as a composer package on https://packagist.org/ would greatly help with development flow. I also work a lot with docker and various CI pipelines and currently when I perform the PHPStan phase there are no files available to statically check signatures. I have to either install the package into the special PHPStan container or add @phpstan-ignore-next-line.

zobo avatar Oct 10 '23 07:10 zobo

Just if anybody stumbles upon this, how I curranty work around is by adding a repository in my composer.json

{
    "repositories": {
        {
            "type": "package",
            "package": {
                "name": "elastic/apm-agent",
                "version": "1.9.1",
                "dist": { "url": "https://github.com/elastic/apm-agent-php/archive/refs/tags/v1.9.1.zip", "type": "zip" }
            }
        },
    },
...
    "require-dev": {
        "elastic/apm-agent": "1.9.1"
    }
}

Alternatively you can use a GIT repository. See https://getcomposer.org/doc/04-schema.md#repositories

zobo avatar Oct 10 '23 08:10 zobo