hashicorp / hashicorp/packer-plugin-googlecompute

GCP import post processor: -force option does not work

Open
#71 1 comment 2 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
33
Forks
72
Avg merge
6h 47m
Merged PRs (30d)
3

Description

_This issue was originally opened by @cevich in https://github.com/hashicorp/packer/issues/9872 and has been migrated to this repository. The original issue description is below._

---
#### Overview of the Issue

Importing Fedora image through the (advanced/complex) nested KVM -> googlecompute-import post-processor works fine the first time. However, when executing packer build a second time, ***while specifying -force option***, we get this error message.

#### Reproduction Steps

qemu *builder* -> shell *provisioner* -> *compress* then googlecompute-import *post-processors*

### Packer version

1.4.5

### Simplified Packer Buildfile

https://github.com/containers/automation_images/blob/master/base_images/gce.yml

### Operating system and Environment details

Host is running CentOS 8 in GCE, but problem is also reproducible locally in a CentOS 8 container (provided GCE application default credentials).

### Log Fragments and crash.log files

```
==> fedora (googlecompute-import): Uploading file /tmp/automation_images_tmp/fedora/disk.raw.tar.gz to GCS bucket packer-import/fedora-1598993532.tar.gz...
==> fedora (googlecompute-import): Creating GCE image fedora-b1598993532...
==> fedora (googlecompute-import): Error creating GCE image
2020/09/01 21:26:49 Deleting original artifact for build 'fedora'
Build 'fedora' errored: 1 error(s) occurred:

* Post-processor failed: googleapi: Error 409: The resource 'projects/libpod-218412/global/images/fedora-b1598993532' already exists, alreadyExists
2020/09/01 21:26:49 machine readable: error-count []string{"1"}
==> Some builds didn't complete successfully and had errors:
2020/09/01 21:26:49 machine readable: fedora,error []string{"1 error(s) occurred:\n\n* Post-processor failed: googleapi: Error 409: The resource 'projects/libpod-218412/global/images/fedora-b1598993532' already exists, alreadyExists"}

* Post-processor failed: googleapi: Error 409: The resource 'projects/libpod-218412/global/images/fedora-b1598993532' already exists, alreadyExists
==> Builds finished but no artifacts were created.
* Post-processor failed: googleapi: Error 409: The resource 'projects/libpod-218412/global/images/fedora-b1598993532' already exists, alreadyExists

==> Some builds didn't complete successfully and had errors:
--> fedora: 1 error(s) occurred:

* Post-processor failed: googleapi: Error 409: The resource 'projects/libpod-218412/global/images/fedora-b1598993532' already exists, alreadyExists

2020/09/01 21:26:49 waiting for all plugin processes to complete...
==> Builds finished but no artifacts were created.
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.