Skip to content

Add support to authenticate to GCP via GOOGLE_APPLICATION_CREDENTIALS file #2606

@mrodm

Description

@mrodm

Add support in elastic-package to use GOOGLE_APPLICATION_CREDENTIALS environment variable to be able to authenticate against GCP provider (documentation).

This variable is set in CI via this Buildkite plugin:

https://github.com/mrodm/oblt-google-auth-buildkite-plugin/blob/2468fe096ba7f559b0b0b63e9ec17c7a2ab12fab/hooks/environment#L32

In order to be used by elastic-package in system tests, this variable must be added to:

  • terraform container
  • elastic-agent container
    • elastic-agent must have access to the same files
      elastic-agent:
      image: "${ELASTIC_AGENT_IMAGE_REF}"
      depends_on:
      fleet-server:
      condition: service_healthy
      healthcheck:
      test: "elastic-agent status"
      timeout: 2s
      start_period: 360s
      retries: 180
      interval: 5s
      hostname: docker-fleet-agent
      env_file: "./elastic-agent.env"
      cap_drop:
      - ALL
      ports: [{{ fact "agent_publish_ports" }}]
      volumes:
      - "../certs/ca-cert.pem:/etc/ssl/certs/elastic-package.pem"
      - type: bind
      source: ../../../tmp/service_logs/
      target: /tmp/service_logs/
      # Mount service_logs under /run too as a testing workaround for the journald input (see elastic-package#1235).
      - type: bind
      source: ../../../tmp/service_logs/
      target: /run/service_logs/

According to that Buildkite plugin, it should also be mounted TOKEN_FILE. This file path can be obtained via in the Buildkite pre-command hook: "${BUILDKITE_OIDC_TMPDIR}"/token.json

Requisites:

  • Test all packages in integrations repository
  • Test scenarios where those environment variables are not defined (e.g. our own laptops)
  • It does not affect to the current authentication to upload files to the private bucket.

As context, previouslyelastic-package was testing a package using GCP resources via the GOOGLE_CREDENTIALS environment variable:

This package was removed in #1930

Relates

Metadata

Metadata

Assignees

No one assigned

    Labels

    Team:EcosystemLabel for the Packages Ecosystem team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions