Dagger
Search

gcp

This module lets you push a container into Google Artifact Registry, automating the tedious manual steps of setting up a service account for the docker credential

For more info and sample usage, check the readme: https://github.com/lukemarsden/dagger-gcp

Installation

dagger install github.com/lukemarsden/dagger-gcp@v0.1.3

Entrypoint

Return Type
Gcp
Example
func (m *myModule) example() *Gcp  {
	return dag.
			Gcp()
}
@function
def example() -> dag.Gcp:
	return (
		dag.gcp()
	)
@func()
example(): Gcp {
	return dag
		.gcp()
}

Types

Gcp 🔗

getSecret() 🔗

example usage: “dagger call get-secret –gcp-credentials ~/.config/gcloud/credentials.db”

Return Type
String !
Arguments
NameTypeDefault ValueDescription
gcpCredentialsFile !-No description provided
Example
dagger -m github.com/lukemarsden/dagger-gcp@0234136d8c894049ab9998da46180510f33d0174 call \
 get-secret --gcp-credentials file:path
func (m *myModule) example(ctx context.Context, gcpCredentials *File) string  {
	return dag.
			Gcp().
			GetSecret(ctx, gcpCredentials)
}
@function
async def example(gcp_credentials: dagger.File) -> str:
	return await (
		dag.gcp()
		.get_secret(gcp_credentials)
	)
@func()
async example(gcpCredentials: File): Promise<string> {
	return dag
		.gcp()
		.getSecret(gcpCredentials)
}

withGcpSecret() 🔗

Return Type
Container !
Arguments
NameTypeDefault ValueDescription
ctrContainer !-No description provided
gcpCredentialsFile !-No description provided
Example
dagger -m github.com/lukemarsden/dagger-gcp@0234136d8c894049ab9998da46180510f33d0174 call \
 with-gcp-secret --ctr IMAGE:TAG --gcp-credentials file:path
func (m *myModule) example(ctr *Container, gcpCredentials *File) *Container  {
	return dag.
			Gcp().
			WithGcpSecret(ctr, gcpCredentials)
}
@function
def example(ctr: dagger.Container, gcp_credentials: dagger.File) -> dagger.Container:
	return (
		dag.gcp()
		.with_gcp_secret(ctr, gcp_credentials)
	)
@func()
example(ctr: Container, gcpCredentials: File): Container {
	return dag
		.gcp()
		.withGcpSecret(ctr, gcpCredentials)
}

gcloudCli() 🔗

Return Type
Container !
Arguments
NameTypeDefault ValueDescription
projectString !-No description provided
gcpCredentialsFile !-No description provided
Example
dagger -m github.com/lukemarsden/dagger-gcp@0234136d8c894049ab9998da46180510f33d0174 call \
 gcloud-cli --project string --gcp-credentials file:path
func (m *myModule) example(project string, gcpCredentials *File) *Container  {
	return dag.
			Gcp().
			GcloudCli(project, gcpCredentials)
}
@function
def example(project: str, gcp_credentials: dagger.File) -> dagger.Container:
	return (
		dag.gcp()
		.gcloud_cli(project, gcp_credentials)
	)
@func()
example(project: string, gcpCredentials: File): Container {
	return dag
		.gcp()
		.gcloudCli(project, gcpCredentials)
}

list() 🔗

example usage: “dagger call list –account your@email.address –project gcp-project-id –gcp-credentials ~/.config/gcloud/credentials.db”

Return Type
String !
Arguments
NameTypeDefault ValueDescription
accountString !-No description provided
projectString !-No description provided
gcpCredentialsFile !-No description provided
Example
dagger -m github.com/lukemarsden/dagger-gcp@0234136d8c894049ab9998da46180510f33d0174 call \
 list --account string --project string --gcp-credentials file:path
func (m *myModule) example(ctx context.Context, account string, project string, gcpCredentials *File) string  {
	return dag.
			Gcp().
			List(ctx, account, project, gcpCredentials)
}
@function
async def example(account: str, project: str, gcp_credentials: dagger.File) -> str:
	return await (
		dag.gcp()
		.list(account, project, gcp_credentials)
	)
@func()
async example(account: string, project: string, gcpCredentials: File): Promise<string> {
	return dag
		.gcp()
		.list(account, project, gcpCredentials)
}

garEnsureServiceAccountKey() 🔗

example usage: “dagger call gar-ensure-service-account –region us-east-1 –project gcp-project-id –gcp-credentials ~/.config/gcloud/credentials.db”

Return Type
String !
Arguments
NameTypeDefault ValueDescription
accountString !-No description provided
regionString !-No description provided
projectString !-No description provided
gcpCredentialsFile !-No description provided
Example
dagger -m github.com/lukemarsden/dagger-gcp@0234136d8c894049ab9998da46180510f33d0174 call \
 gar-ensure-service-account-key --account string --region string --project string --gcp-credentials file:path
func (m *myModule) example(ctx context.Context, account string, region string, project string, gcpCredentials *File) string  {
	return dag.
			Gcp().
			GarEnsureServiceAccountKey(ctx, account, region, project, gcpCredentials)
}
@function
async def example(account: str, region: str, project: str, gcp_credentials: dagger.File) -> str:
	return await (
		dag.gcp()
		.gar_ensure_service_account_key(account, region, project, gcp_credentials)
	)
@func()
async example(account: string, region: string, project: string, gcpCredentials: File): Promise<string> {
	return dag
		.gcp()
		.garEnsureServiceAccountKey(account, region, project, gcpCredentials)
}

garPushExample() 🔗

Push ubuntu:latest to GAR under given repo ‘test’ (repo must be created first) example usage: “dagger call gar-push-example –region us-east-1 –gcp-credentials ~/.config/gcloud/credentials.db –gcp-account-id 12345 –repo test”

Return Type
String !
Arguments
NameTypeDefault ValueDescription
accountString !-No description provided
regionString !-No description provided
projectString !-No description provided
repoString !-No description provided
imageString !-No description provided
gcpCredentialsFile !-No description provided
Example
dagger -m github.com/lukemarsden/dagger-gcp@0234136d8c894049ab9998da46180510f33d0174 call \
 gar-push-example --account string --region string --project string --repo string --image string --gcp-credentials file:path
func (m *myModule) example(ctx context.Context, account string, region string, project string, repo string, image string, gcpCredentials *File) string  {
	return dag.
			Gcp().
			GarPushExample(ctx, account, region, project, repo, image, gcpCredentials)
}
@function
async def example(account: str, region: str, project: str, repo: str, image: str, gcp_credentials: dagger.File) -> str:
	return await (
		dag.gcp()
		.gar_push_example(account, region, project, repo, image, gcp_credentials)
	)
@func()
async example(account: string, region: string, project: string, repo: string, image: string, gcpCredentials: File): Promise<string> {
	return dag
		.gcp()
		.garPushExample(account, region, project, repo, image, gcpCredentials)
}

cleanupServiceAccountKey() 🔗

Return Type
Void !
Arguments
NameTypeDefault ValueDescription
accountString !-No description provided
regionString !-No description provided
projectString !-No description provided
gcpCredentialsFile !-No description provided
keyIdString !-No description provided
Example
dagger -m github.com/lukemarsden/dagger-gcp@0234136d8c894049ab9998da46180510f33d0174 call \
 cleanup-service-account-key --account string --region string --project string --gcp-credentials file:path --key-id string
func (m *myModule) example(ctx context.Context, account string, region string, project string, gcpCredentials *File, keyId string)   {
	return dag.
			Gcp().
			CleanupServiceAccountKey(ctx, account, region, project, gcpCredentials, keyId)
}
@function
async def example(account: str, region: str, project: str, gcp_credentials: dagger.File, key_id: str) -> None:
	return await (
		dag.gcp()
		.cleanup_service_account_key(account, region, project, gcp_credentials, key_id)
	)
@func()
async example(account: string, region: string, project: string, gcpCredentials: File, keyId: string): Promise<void> {
	return dag
		.gcp()
		.cleanupServiceAccountKey(account, region, project, gcpCredentials, keyId)
}

garPush() 🔗

Return Type
String !
Arguments
NameTypeDefault ValueDescription
pushCtrContainer !-No description provided
accountString !-No description provided
regionString !-No description provided
projectString !-No description provided
repoString !-No description provided
imageString !-No description provided
gcpCredentialsFile !-No description provided
Example
dagger -m github.com/lukemarsden/dagger-gcp@0234136d8c894049ab9998da46180510f33d0174 call \
 gar-push --push-ctr IMAGE:TAG --account string --region string --project string --repo string --image string --gcp-credentials file:path
func (m *myModule) example(ctx context.Context, pushCtr *Container, account string, region string, project string, repo string, image string, gcpCredentials *File) string  {
	return dag.
			Gcp().
			GarPush(ctx, pushCtr, account, region, project, repo, image, gcpCredentials)
}
@function
async def example(push_ctr: dagger.Container, account: str, region: str, project: str, repo: str, image: str, gcp_credentials: dagger.File) -> str:
	return await (
		dag.gcp()
		.gar_push(push_ctr, account, region, project, repo, image, gcp_credentials)
	)
@func()
async example(pushCtr: Container, account: string, region: string, project: string, repo: string, image: string, gcpCredentials: File): Promise<string> {
	return dag
		.gcp()
		.garPush(pushCtr, account, region, project, repo, image, gcpCredentials)
}