Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refacto #177

Merged
merged 5 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ensure-docs-compiled.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ jobs:
- name: Checkout 🛎
uses: actions/checkout@v2
- uses: actions/setup-go@v4
with:
go-version: 'stable'
- shell: bash
run: make generate
- shell: bash
Expand Down
8 changes: 4 additions & 4 deletions .web-docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ If you do that, you can remove `required_plugins` from packer file.

#### Builders

-> **Don't know which builder to use?** If in doubt, use the [osc-bsu builder](/packer/integrations/outscale/outscale/latest/components/builder/osc/bsu). It is much easier to use and Outscale generally recommends BSU-backed images nowadays.
-> **Don't know which builder to use?** If in doubt, use the [osc-bsu builder](/packer/integrations/outscale/outscale/latest/components/builder/bsu). It is much easier to use and Outscale generally recommends BSU-backed images nowadays.

- [outscale-bsu](/packer/integrations/outscale/outscale/latest/components/builder/osc/bsu) - Create BSU-backed OMIs by
- [outscale-bsu](/packer/integrations/outscale/outscale/latest/components/builder/bsu) - Create BSU-backed OMIs by
launching a source OMI and re-packaging it into a new OMI after
provisioning. If in doubt, use this builder, which is the easiest to get
started with.
Expand All @@ -45,10 +45,10 @@ If you do that, you can remove `required_plugins` from packer file.
that device. This is an **advanced builder and should not be used by
newcomers**. However, it is also the fastest way to build an EBS-backed OMI
since no new OUTSCALE VM needs to be launched.
- [outscale-bsusurrogate](/packer/integrations/outscale/outscale/latest/components/builder/osc/bsusurrogate) - Create BSU-backed OMIs from scratch. Works similarly to the `chroot` builder but does
- [outscale-bsusurrogate](/packer/integrations/outscale/outscale/latest/components/builder/bsusurrogate) - Create BSU-backed OMIs from scratch. Works similarly to the `chroot` builder but does
not require running in Outscale VM. This is an **advanced builder and should not be
used by newcomers**.
- [outscale-bsuvolume](/packer/integrations/outscale/outscale/latest/components/builder/osc/bsuvolume) - Create EBS volumes by launching a source OMI with block devices mapped. Provision the VM, then destroy it, retaining the EBS volumes.
- [outscale-bsuvolume](/packer/integrations/outscale/outscale/latest/components/builder/bsuvolume) - Create EBS volumes by launching a source OMI with block devices mapped. Provision the VM, then destroy it, retaining the EBS volumes.

#### Data Sources
- [outscale-omi](/packer/integrations/outscale/outscale/latest/components/data-source/omi) - The Outscale OMI Data source will filter and fetch an Outscale OMI.
Expand Down
20 changes: 10 additions & 10 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,28 @@ HASHICORP_PACKER_PLUGIN_SDK_VERSION?=$(shell go list -m github.com/hashicorp/pac
.PHONY: dev

build:
@go build -o ${BINARY}
go build -o ${BINARY}

dev: build
@mkdir -p ~/.packer.d/plugins/
@mv ${BINARY} ~/.packer.d/plugins/${BINARY}
mkdir -p ~/.packer.d/plugins/
mv ${BINARY} ~/.packer.d/plugins/${BINARY}

test:
@go test -race -count $(COUNT) $(TEST) -timeout=3m
go test -race -count $(COUNT) $(TEST) -timeout=3m

install-packer-sdc: ## Install packer sofware development command
@go install github.com/hashicorp/packer-plugin-sdk/cmd/packer-sdc@${HASHICORP_PACKER_PLUGIN_SDK_VERSION}
go install github.com/hashicorp/packer-plugin-sdk/cmd/packer-sdc@${HASHICORP_PACKER_PLUGIN_SDK_VERSION}

plugin-check: install-packer-sdc build
@packer-sdc plugin-check ${BINARY}
packer-sdc plugin-check ${BINARY}

testacc: dev
@PACKER_ACC=1 go test -count $(COUNT) -v $(TEST) -timeout=120m

generate: install-packer-sdc
@go generate ./...
@if [ -d ".docs" ]; then rm -r ".docs"; fi
go generate ./...
if [ -d ".docs" ]; then rm -r ".docs"; fi
packer-sdc renderdocs -src "docs" -partials docs-partials/ -dst ".docs/"
@./.web-docs/scripts/compile-to-webdocs.sh "." ".docs" ".web-docs" "outscale"
@rm -r ".docs"
./.web-docs/scripts/compile-to-webdocs.sh "." ".docs" ".web-docs" "outscale"
rm -r ".docs"
# checkout the .docs folder for a preview of the docs
2 changes: 1 addition & 1 deletion builder/osc/bsu/builder.go → builder/bsu/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
packersdk "github.com/hashicorp/packer-plugin-sdk/packer"
"github.com/hashicorp/packer-plugin-sdk/template/config"
"github.com/hashicorp/packer-plugin-sdk/template/interpolate"
osccommon "github.com/outscale/packer-plugin-outscale/builder/osc/common"
osccommon "github.com/outscale/packer-plugin-outscale/builder/common"
)

// The unique ID for this builder
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/hashicorp/packer-plugin-sdk/multistep"
packersdk "github.com/hashicorp/packer-plugin-sdk/packer"
oscgo "github.com/outscale/osc-sdk-go/v2"
osccommon "github.com/outscale/packer-plugin-outscale/builder/osc/common"
osccommon "github.com/outscale/packer-plugin-outscale/builder/common"
)

type stepCreateOMI struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
packersdk "github.com/hashicorp/packer-plugin-sdk/packer"
"github.com/hashicorp/packer-plugin-sdk/template/config"
"github.com/hashicorp/packer-plugin-sdk/template/interpolate"
osccommon "github.com/outscale/packer-plugin-outscale/builder/osc/common"
osccommon "github.com/outscale/packer-plugin-outscale/builder/common"
)

const BuilderId = "oapi.outscale.bsusurrogate"
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
packersdk "github.com/hashicorp/packer-plugin-sdk/packer"
"github.com/outscale/osc-sdk-go/v2"
oscgo "github.com/outscale/osc-sdk-go/v2"
osccommon "github.com/outscale/packer-plugin-outscale/builder/osc/common"
osccommon "github.com/outscale/packer-plugin-outscale/builder/common"
)

// StepRegisterOMI creates the OMI.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/hashicorp/packer-plugin-sdk/multistep"
packersdk "github.com/hashicorp/packer-plugin-sdk/packer"
oscgo "github.com/outscale/osc-sdk-go/v2"
osccommon "github.com/outscale/packer-plugin-outscale/builder/osc/common"
osccommon "github.com/outscale/packer-plugin-outscale/builder/common"
)

// StepSnapshotVolumes creates snapshots of the created volumes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
packersdk "github.com/hashicorp/packer-plugin-sdk/packer"
registryimage "github.com/hashicorp/packer-plugin-sdk/packer/registry/image"
oscgo "github.com/outscale/osc-sdk-go/v2"
osccommon "github.com/outscale/packer-plugin-outscale/builder/osc/common"
osccommon "github.com/outscale/packer-plugin-outscale/builder/common"
)

// map of region to list of volume IDs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package bsuvolume

import (
"github.com/hashicorp/packer-plugin-sdk/template/interpolate"
osccommon "github.com/outscale/packer-plugin-outscale/builder/osc/common"
osccommon "github.com/outscale/packer-plugin-outscale/builder/common"
)

type BlockDevice struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
packersdk "github.com/hashicorp/packer-plugin-sdk/packer"
"github.com/hashicorp/packer-plugin-sdk/template/config"
"github.com/hashicorp/packer-plugin-sdk/template/interpolate"
osccommon "github.com/outscale/packer-plugin-outscale/builder/osc/common"
osccommon "github.com/outscale/packer-plugin-outscale/builder/common"
)

const BuilderId = "oapi.outscale.bsuvolume"
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
packersdk "github.com/hashicorp/packer-plugin-sdk/packer"
"github.com/hashicorp/packer-plugin-sdk/template/interpolate"
oscgo "github.com/outscale/osc-sdk-go/v2"
osccommon "github.com/outscale/packer-plugin-outscale/builder/osc/common"
osccommon "github.com/outscale/packer-plugin-outscale/builder/common"
)

type stepTagBSUVolumes struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
packersdk "github.com/hashicorp/packer-plugin-sdk/packer"
"github.com/hashicorp/packer-plugin-sdk/template/config"
"github.com/hashicorp/packer-plugin-sdk/template/interpolate"
osccommon "github.com/outscale/packer-plugin-outscale/builder/osc/common"
osccommon "github.com/outscale/packer-plugin-outscale/builder/common"
)

// The unique ID for this builder
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/hashicorp/packer-plugin-sdk/multistep"
packersdk "github.com/hashicorp/packer-plugin-sdk/packer"
oscgo "github.com/outscale/osc-sdk-go/v2"
osccommon "github.com/outscale/packer-plugin-outscale/builder/osc/common"
osccommon "github.com/outscale/packer-plugin-outscale/builder/common"
)

// StepCreateOMI creates the OMI.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
packersdk "github.com/hashicorp/packer-plugin-sdk/packer"
"github.com/hashicorp/packer-plugin-sdk/template/interpolate"
oscgo "github.com/outscale/osc-sdk-go/v2"
osccommon "github.com/outscale/packer-plugin-outscale/builder/osc/common"
osccommon "github.com/outscale/packer-plugin-outscale/builder/common"
)

// StepCreateVolume creates a new volume from the snapshot of the root
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/hashicorp/packer-plugin-sdk/multistep"
packersdk "github.com/hashicorp/packer-plugin-sdk/packer"
oscgo "github.com/outscale/osc-sdk-go/v2"
osccommon "github.com/outscale/packer-plugin-outscale/builder/osc/common"
osccommon "github.com/outscale/packer-plugin-outscale/builder/common"
)

// StepLinkVolume attaches the previously created volume to an
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/hashicorp/packer-plugin-sdk/multistep"
packersdk "github.com/hashicorp/packer-plugin-sdk/packer"
oscgo "github.com/outscale/osc-sdk-go/v2"
osccommon "github.com/outscale/packer-plugin-outscale/builder/osc/common"
osccommon "github.com/outscale/packer-plugin-outscale/builder/common"
)

// StepSnapshot creates a snapshot of the created volume.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/hashicorp/packer-plugin-sdk/multistep"
packersdk "github.com/hashicorp/packer-plugin-sdk/packer"
oscgo "github.com/outscale/osc-sdk-go/v2"
osccommon "github.com/outscale/packer-plugin-outscale/builder/osc/common"
osccommon "github.com/outscale/packer-plugin-outscale/builder/common"
)

// StepVmInfo verifies that this builder is running on an Outscale vm.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion builder/osc/common/state.go → builder/common/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"log"

oscgo "github.com/outscale/osc-sdk-go/v2"
"github.com/outscale/packer-plugin-outscale/builder/osc/common/retry"
"github.com/outscale/packer-plugin-outscale/builder/common/retry"
)

type stateRefreshFunc func() (string, error)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
packersdk "github.com/hashicorp/packer-plugin-sdk/packer"
"github.com/hashicorp/packer-plugin-sdk/template/interpolate"
oscgo "github.com/outscale/osc-sdk-go/v2"
"github.com/outscale/packer-plugin-outscale/builder/osc/common/retry"
"github.com/outscale/packer-plugin-outscale/builder/common/retry"
)

type StepCreateTags struct {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"github.com/hashicorp/packer-plugin-sdk/multistep"
packersdk "github.com/hashicorp/packer-plugin-sdk/packer"
"github.com/hashicorp/packer-plugin-sdk/template/interpolate"
"github.com/outscale/packer-plugin-outscale/builder/osc/common/retry"
"github.com/outscale/packer-plugin-outscale/builder/common/retry"
)

const (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/hashicorp/packer-plugin-sdk/multistep"
packersdk "github.com/hashicorp/packer-plugin-sdk/packer"
oscgo "github.com/outscale/osc-sdk-go/v2"
"github.com/outscale/packer-plugin-outscale/builder/osc/common/retry"
"github.com/outscale/packer-plugin-outscale/builder/common/retry"
)

type StepStopBSUBackedVm struct {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion datasource/omi/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/hashicorp/packer-plugin-sdk/template/config"
"github.com/hashicorp/packer-plugin-sdk/template/interpolate"
oscgo "github.com/outscale/osc-sdk-go/v2"
osccommon "github.com/outscale/packer-plugin-outscale/builder/osc/common"
osccommon "github.com/outscale/packer-plugin-outscale/builder/common"
"github.com/zclconf/go-cty/cty"
)

Expand Down
2 changes: 1 addition & 1 deletion datasource/omi/data_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"testing"

"github.com/hashicorp/packer-plugin-sdk/template/config"
"github.com/outscale/packer-plugin-outscale/builder/osc/common"
"github.com/outscale/packer-plugin-outscale/builder/common"
)

func TestDatasourceConfigure_FilterBlank(t *testing.T) {
Expand Down
8 changes: 4 additions & 4 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ If you do that, you can remove `required_plugins` from packer file.

#### Builders

-> **Don't know which builder to use?** If in doubt, use the [osc-bsu builder](/packer/integrations/outscale/outscale/latest/components/builder/osc/bsu). It is much easier to use and Outscale generally recommends BSU-backed images nowadays.
-> **Don't know which builder to use?** If in doubt, use the [osc-bsu builder](/packer/integrations/outscale/outscale/latest/components/builder/bsu). It is much easier to use and Outscale generally recommends BSU-backed images nowadays.

- [outscale-bsu](/packer/integrations/outscale/outscale/latest/components/builder/osc/bsu) - Create BSU-backed OMIs by
- [outscale-bsu](/packer/integrations/outscale/outscale/latest/components/builder/bsu) - Create BSU-backed OMIs by
launching a source OMI and re-packaging it into a new OMI after
provisioning. If in doubt, use this builder, which is the easiest to get
started with.
Expand All @@ -45,10 +45,10 @@ If you do that, you can remove `required_plugins` from packer file.
that device. This is an **advanced builder and should not be used by
newcomers**. However, it is also the fastest way to build an EBS-backed OMI
since no new OUTSCALE VM needs to be launched.
- [outscale-bsusurrogate](/packer/integrations/outscale/outscale/latest/components/builder/osc/bsusurrogate) - Create BSU-backed OMIs from scratch. Works similarly to the `chroot` builder but does
- [outscale-bsusurrogate](/packer/integrations/outscale/outscale/latest/components/builder/bsusurrogate) - Create BSU-backed OMIs from scratch. Works similarly to the `chroot` builder but does
not require running in Outscale VM. This is an **advanced builder and should not be
used by newcomers**.
- [outscale-bsuvolume](/packer/integrations/outscale/outscale/latest/components/builder/osc/bsuvolume) - Create EBS volumes by launching a source OMI with block devices mapped. Provision the VM, then destroy it, retaining the EBS volumes.
- [outscale-bsuvolume](/packer/integrations/outscale/outscale/latest/components/builder/bsuvolume) - Create EBS volumes by launching a source OMI with block devices mapped. Provision the VM, then destroy it, retaining the EBS volumes.

#### Data Sources
- [outscale-omi](/packer/integrations/outscale/outscale/latest/components/data-source/omi) - The Outscale OMI Data source will filter and fetch an Outscale OMI.
Expand Down
Loading
Loading