Skip to content

Environment variable for certificateChain not supported #2008

@anusreelakshmi934

Description

@anusreelakshmi934

What happened?

When trying to configure the plugin signing task using environment variables, passing the raw certificate content to certificateChain.set() fails with Invalid argument, whereas pointing to a file works.

Example that fails:

signing {
    certificateChain.set(System.getenv("CERTIFICATE_CHAIN"))
    privateKey.set(System.getenv("PRIVATE_KEY"))
    password.set(System.getenv("PRIVATE_KEY_PASSWORD"))
}

Error:

Invalid argument: -----BEGIN CERTIFICATE-----
MIIF5zCCA8+gAwIBAgIU...

Example that works:

signing {
    certificateChainFile = file("/Users/.../chain.crt") // path to file
    privateKey.set(System.getenv("PRIVATE_KEY"))
    password.set(System.getenv("PRIVATE_KEY_PASSWORD"))
}

Shouldn't it be possible to pass the certificate content via an environment variable (multi-line string) without having to write it to a file manually?

Steps to reproduce

Set an environment variable CERTIFICATE_CHAIN with the full multi-line certificate content.
Configure signing using certificateChain.set(System.getenv("CERTIFICATE_CHAIN")).
Run ./gradlew verifyPluginSignature.

Gradle IntelliJ Plugin version

2.7.0

Gradle version

8.11.1

Operating System

macOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions