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

plugin refactor for v4 #101

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

plugin refactor for v4 #101

wants to merge 2 commits into from

Conversation

FalcoSuessgott
Copy link
Collaborator

@FalcoSuessgott FalcoSuessgott commented Jul 7, 2024

build {
  sources = [""]

  provisioner "goss" {

    # block specifying any goss download parameters. Goss is downloaded using curl and wget as a fallback installation method
    installation {
      # wether to use sudo for the curl/wget download; # optional; default:  false
      use_sudo = false

      # the goss version to download; optional; default: "latest"
      version = "latest"

      # the architecture to download; optional; default: "amd64"
      arch = "amd64"

      # the operating system to download; optional; default: "Linux", options: "Windows", "Linux"
      os = "Linux"

      # the url to download goss from; optional; default: "ttps://github.com/goss-org/goss/releases/download/{{ Version }}/goss-{{ Version }}-{{ Os }}-{{ Arch }}"
      url = ""

      # the checksum to verify the downloaded goss binary; optional; default: false
      skip_ssl = false

      # the path to download goss to; optional; default: "/tmp/goss-{{ Version }}-{{ Os }}-{{ Arch }}"
      download_path = ""

      # username for basic auth; optional; default: ""
      username = ""

      # password for basic auth; optional; default: ""
      password = ""

      # a map of any extra env vars to pass to the download request; optional; default: {}
      env_vars = {}

      # wether to skip the installation
      skip_installation = false
    }

    # block specifying any goss validate parameters
    validate {
      # wether to use sudo for the goss validate command; # optional; default:  false
      use_sudo = false

      # a goss vars file; optional; default: ""
      vars_file = ""

      # a gossfile; optional; default: "./goss.yaml"
      goss_file = ""

      # a map of any goss inline vars for rendering a gossfile; optional; default: {}
      vars_inline = {}

      # a map of any extra env vars to pass to the download request; optional; default: {}
      env_vars = {}

      # loglevel; optional; values: "TRACE", "DEBUG", "INFO", "WARN", "ERROR"
      log_level = ""

      # package type; optional; values: "apk", "dpkg", "pacman", "rpm"
      package = ""

      # a retry timeout for goss validate; optional; default: "0s"
      retry_timeut = ""

      # a sllep timeout for goss validate; optonal; default: "1s"
      sleep = ""

      # the goss test results format; optional; values: "documentation", "json", "json_oneline", "junit", "nagios", "nagios_verbose", "rspecish", "silent", "tap"
      format = ""

      # the goss test results format options; values; default: "perfdata", "verbose", "pretty"
      format_options = ""

      # where to write the goss test results to; optional; default: ""
      output_file = ""
    }
  }
}

@FalcoSuessgott FalcoSuessgott force-pushed the refactor branch 8 times, most recently from 080a90b to 1112d7e Compare July 7, 2024 04:16
@FalcoSuessgott
Copy link
Collaborator Author

FalcoSuessgott commented Jul 7, 2024

looking for volunteers to test if anyone has some time ...
@F21 do you have time to test this with me?

@FalcoSuessgott FalcoSuessgott marked this pull request as draft July 7, 2024 04:53
@FalcoSuessgott FalcoSuessgott force-pushed the refactor branch 11 times, most recently from 89c6c32 to b6b999a Compare July 8, 2024 03:58
@FalcoSuessgott FalcoSuessgott marked this pull request as ready for review July 8, 2024 03:59
@FalcoSuessgott FalcoSuessgott force-pushed the refactor branch 3 times, most recently from 5893fee to ad34599 Compare July 8, 2024 04:05
@FalcoSuessgott FalcoSuessgott changed the title Refactor plugin refactor for v4 Jul 8, 2024
@FalcoSuessgott FalcoSuessgott force-pushed the refactor branch 4 times, most recently from cef88b1 to cdab737 Compare July 8, 2024 09:20
@F21
Copy link
Contributor

F21 commented Jul 25, 2024

Sorry for the delay in looking at this (been super busy for the last few weeks). I built the plugin, installed it manually and created a test packer file using docker as the source. My packer file is super simple, so I have not tested every single option/knob, but I think the change is pretty solid from looking at the code:
docker-ubuntu.pkr.hcl:

packer {
  required_plugins {
    docker = {
      version = ">= 1.0.10"
      source  = "github.com/hashicorp/docker"
    }
    goss = {
      version = "0.0.1"
      source  = "github.com/YaleUniversity/goss"
    }
  }
}

source "docker" "ubuntu" {
  image  = "ubuntu:jammy"
  commit = true
}

build {
  name = "learn-packer"
  sources = [
    "source.docker.ubuntu"
  ]
  provisioner "shell" {
    environment_vars = [
      "FOO=hello world",
    ]
    inline = [
      "echo $PWD",
      "apt update",
      "apt install -y curl",
      "echo Adding file to Docker Container",
      "echo \"FOO is $FOO\" > example.txt",
    ]
  }
  provisioner "goss" {}
}

goss.yaml:

file:
  example.txt:
    exists: true

Result:

$ packer build .
learn-packer.docker.ubuntu: output will be in this color.

==> learn-packer.docker.ubuntu: Creating a temporary directory for sharing data...
==> learn-packer.docker.ubuntu: Pulling Docker image: ubuntu:jammy
    learn-packer.docker.ubuntu: jammy: Pulling from library/ubuntu
    learn-packer.docker.ubuntu: Digest: sha256:340d9b015b194dc6e2a13938944e0d016e57b9679963fdeb9ce021daac430221
    learn-packer.docker.ubuntu: Status: Image is up to date for ubuntu:jammy
    learn-packer.docker.ubuntu: docker.io/library/ubuntu:jammy
==> learn-packer.docker.ubuntu: Starting docker container...
    learn-packer.docker.ubuntu: Run command: docker run -v /home/user/.config/packer/tmp4047896569:/packer-files -d -i -t --entrypoint=/bin/sh -- ubuntu:jammy
    learn-packer.docker.ubuntu: Container ID: b7569cc4b587e7cb62dac8e7384b564bd96cdbffa87b8ddca1c495f7258e98bc
==> learn-packer.docker.ubuntu: Using docker communicator to connect: 172.17.0.2
==> learn-packer.docker.ubuntu: Provisioning with shell script: /tmp/packer-shell222780874
    learn-packer.docker.ubuntu: /
==> learn-packer.docker.ubuntu:
==> learn-packer.docker.ubuntu: WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
==> learn-packer.docker.ubuntu:
    learn-packer.docker.ubuntu: Get:1 http://archive.ubuntu.com/ubuntu jammy InRelease [270 kB]
    learn-packer.docker.ubuntu: Get:2 http://security.ubuntu.com/ubuntu jammy-security InRelease [129 kB]
    learn-packer.docker.ubuntu: Get:3 http://security.ubuntu.com/ubuntu jammy-security/main amd64 Packages [2104 kB]
    learn-packer.docker.ubuntu: Get:4 http://archive.ubuntu.com/ubuntu jammy-updates InRelease [128 kB]
    learn-packer.docker.ubuntu: Get:5 http://archive.ubuntu.com/ubuntu jammy-backports InRelease [127 kB]
    learn-packer.docker.ubuntu: Get:6 http://archive.ubuntu.com/ubuntu jammy/restricted amd64 Packages [164 kB]
    learn-packer.docker.ubuntu: Get:7 http://archive.ubuntu.com/ubuntu jammy/universe amd64 Packages [17.5 MB]
    learn-packer.docker.ubuntu: Get:8 http://security.ubuntu.com/ubuntu jammy-security/universe amd64 Packages [1129 kB]
    learn-packer.docker.ubuntu: Get:9 http://security.ubuntu.com/ubuntu jammy-security/multiverse amd64 Packages [44.7 kB]
    learn-packer.docker.ubuntu: Get:10 http://security.ubuntu.com/ubuntu jammy-security/restricted amd64 Packages [2771 kB]
    learn-packer.docker.ubuntu: Get:11 http://archive.ubuntu.com/ubuntu jammy/main amd64 Packages [1792 kB]
    learn-packer.docker.ubuntu: Get:12 http://archive.ubuntu.com/ubuntu jammy/multiverse amd64 Packages [266 kB]
    learn-packer.docker.ubuntu: Get:13 http://archive.ubuntu.com/ubuntu jammy-updates/restricted amd64 Packages [2858 kB]
    learn-packer.docker.ubuntu: Get:14 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages [2378 kB]
    learn-packer.docker.ubuntu: Get:15 http://archive.ubuntu.com/ubuntu jammy-updates/multiverse amd64 Packages [51.8 kB]
    learn-packer.docker.ubuntu: Get:16 http://archive.ubuntu.com/ubuntu jammy-updates/universe amd64 Packages [1420 kB]
    learn-packer.docker.ubuntu: Get:17 http://archive.ubuntu.com/ubuntu jammy-backports/main amd64 Packages [81.0 kB]
    learn-packer.docker.ubuntu: Get:18 http://archive.ubuntu.com/ubuntu jammy-backports/universe amd64 Packages [33.7 kB]
    learn-packer.docker.ubuntu: Fetched 33.2 MB in 13s (2518 kB/s)
    learn-packer.docker.ubuntu: Reading package lists...
    learn-packer.docker.ubuntu: Building dependency tree...
    learn-packer.docker.ubuntu: Reading state information...
    learn-packer.docker.ubuntu: All packages are up to date.
==> learn-packer.docker.ubuntu:
==> learn-packer.docker.ubuntu: WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
==> learn-packer.docker.ubuntu:
    learn-packer.docker.ubuntu: Reading package lists...
    learn-packer.docker.ubuntu: Building dependency tree...
    learn-packer.docker.ubuntu: Reading state information...
    learn-packer.docker.ubuntu: The following additional packages will be installed:
    learn-packer.docker.ubuntu:   ca-certificates libbrotli1 libcurl4 libldap-2.5-0 libldap-common
    learn-packer.docker.ubuntu:   libnghttp2-14 libpsl5 librtmp1 libsasl2-2 libsasl2-modules
    learn-packer.docker.ubuntu:   libsasl2-modules-db libssh-4 openssl publicsuffix
    learn-packer.docker.ubuntu: Suggested packages:
    learn-packer.docker.ubuntu:   libsasl2-modules-gssapi-mit | libsasl2-modules-gssapi-heimdal
    learn-packer.docker.ubuntu:   libsasl2-modules-ldap libsasl2-modules-otp libsasl2-modules-sql
    learn-packer.docker.ubuntu: The following NEW packages will be installed:
    learn-packer.docker.ubuntu:   ca-certificates curl libbrotli1 libcurl4 libldap-2.5-0 libldap-common
    learn-packer.docker.ubuntu:   libnghttp2-14 libpsl5 librtmp1 libsasl2-2 libsasl2-modules
    learn-packer.docker.ubuntu:   libsasl2-modules-db libssh-4 openssl publicsuffix
    learn-packer.docker.ubuntu: 0 upgraded, 15 newly installed, 0 to remove and 0 not upgraded.
    learn-packer.docker.ubuntu: Need to get 2992 kB of archives.
    learn-packer.docker.ubuntu: After this operation, 7125 kB of additional disk space will be used.
    learn-packer.docker.ubuntu: Get:1 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 openssl amd64 3.0.2-0ubuntu1.16 [1186 kB]
    learn-packer.docker.ubuntu: Get:2 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 ca-certificates all 20230311ubuntu0.22.04.1 [155 kB]
    learn-packer.docker.ubuntu: Get:3 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 libnghttp2-14 amd64 1.43.0-1ubuntu0.2 [76.9 kB]
    learn-packer.docker.ubuntu: Get:4 http://archive.ubuntu.com/ubuntu jammy/main amd64 libpsl5 amd64 0.21.0-1.2build2 [58.4 kB]
    learn-packer.docker.ubuntu: Get:5 http://archive.ubuntu.com/ubuntu jammy/main amd64 publicsuffix all 20211207.1025-1 [129 kB]
    learn-packer.docker.ubuntu: Get:6 http://archive.ubuntu.com/ubuntu jammy/main amd64 libbrotli1 amd64 1.0.9-2build6 [315 kB]
    learn-packer.docker.ubuntu: Get:7 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 libsasl2-modules-db amd64 2.1.27+dfsg2-3ubuntu1.2 [20.5 kB]
    learn-packer.docker.ubuntu: Get:8 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 libsasl2-2 amd64 2.1.27+dfsg2-3ubuntu1.2 [53.8 kB]
    learn-packer.docker.ubuntu: Get:9 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 libldap-2.5-0 amd64 2.5.18+dfsg-0ubuntu0.22.04.2 [183 kB]
    learn-packer.docker.ubuntu: Get:10 http://archive.ubuntu.com/ubuntu jammy/main amd64 librtmp1 amd64 2.4+20151223.gitfa8646d.1-2build4 [58.2 kB]
    learn-packer.docker.ubuntu: Get:11 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 libssh-4 amd64 0.9.6-2ubuntu0.22.04.3 [186 kB]
    learn-packer.docker.ubuntu: Get:12 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 libcurl4 amd64 7.81.0-1ubuntu1.16 [290 kB]
    learn-packer.docker.ubuntu: Get:13 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 curl amd64 7.81.0-1ubuntu1.16 [194 kB]
    learn-packer.docker.ubuntu: Get:14 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 libldap-common all 2.5.18+dfsg-0ubuntu0.22.04.2 [15.9 kB]
    learn-packer.docker.ubuntu: Get:15 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 libsasl2-modules amd64 2.1.27+dfsg2-3ubuntu1.2 [68.8 kB]
==> learn-packer.docker.ubuntu: debconf: delaying package configuration, since apt-utils is not installed
    learn-packer.docker.ubuntu: Fetched 2992 kB in 4s (816 kB/s)
    learn-packer.docker.ubuntu: Selecting previously unselected package openssl.
    learn-packer.docker.ubuntu: (Reading database ... 4393 files and directories currently installed.)
    learn-packer.docker.ubuntu: Preparing to unpack .../00-openssl_3.0.2-0ubuntu1.16_amd64.deb ...
    learn-packer.docker.ubuntu: Unpacking openssl (3.0.2-0ubuntu1.16) ...
    learn-packer.docker.ubuntu: Selecting previously unselected package ca-certificates.
    learn-packer.docker.ubuntu: Preparing to unpack .../01-ca-certificates_20230311ubuntu0.22.04.1_all.deb ...
    learn-packer.docker.ubuntu: Unpacking ca-certificates (20230311ubuntu0.22.04.1) ...
    learn-packer.docker.ubuntu: Selecting previously unselected package libnghttp2-14:amd64.
    learn-packer.docker.ubuntu: Preparing to unpack .../02-libnghttp2-14_1.43.0-1ubuntu0.2_amd64.deb ...
    learn-packer.docker.ubuntu: Unpacking libnghttp2-14:amd64 (1.43.0-1ubuntu0.2) ...
    learn-packer.docker.ubuntu: Selecting previously unselected package libpsl5:amd64.
    learn-packer.docker.ubuntu: Preparing to unpack .../03-libpsl5_0.21.0-1.2build2_amd64.deb ...
    learn-packer.docker.ubuntu: Unpacking libpsl5:amd64 (0.21.0-1.2build2) ...
    learn-packer.docker.ubuntu: Selecting previously unselected package publicsuffix.
    learn-packer.docker.ubuntu: Preparing to unpack .../04-publicsuffix_20211207.1025-1_all.deb ...
    learn-packer.docker.ubuntu: Unpacking publicsuffix (20211207.1025-1) ...
    learn-packer.docker.ubuntu: Selecting previously unselected package libbrotli1:amd64.
    learn-packer.docker.ubuntu: Preparing to unpack .../05-libbrotli1_1.0.9-2build6_amd64.deb ...
    learn-packer.docker.ubuntu: Unpacking libbrotli1:amd64 (1.0.9-2build6) ...
    learn-packer.docker.ubuntu: Selecting previously unselected package libsasl2-modules-db:amd64.
    learn-packer.docker.ubuntu: Preparing to unpack .../06-libsasl2-modules-db_2.1.27+dfsg2-3ubuntu1.2_amd64.deb ...
    learn-packer.docker.ubuntu: Unpacking libsasl2-modules-db:amd64 (2.1.27+dfsg2-3ubuntu1.2) ...
    learn-packer.docker.ubuntu: Selecting previously unselected package libsasl2-2:amd64.
    learn-packer.docker.ubuntu: Preparing to unpack .../07-libsasl2-2_2.1.27+dfsg2-3ubuntu1.2_amd64.deb ...
    learn-packer.docker.ubuntu: Unpacking libsasl2-2:amd64 (2.1.27+dfsg2-3ubuntu1.2) ...
    learn-packer.docker.ubuntu: Selecting previously unselected package libldap-2.5-0:amd64.
    learn-packer.docker.ubuntu: Preparing to unpack .../08-libldap-2.5-0_2.5.18+dfsg-0ubuntu0.22.04.2_amd64.deb ...
    learn-packer.docker.ubuntu: Unpacking libldap-2.5-0:amd64 (2.5.18+dfsg-0ubuntu0.22.04.2) ...
    learn-packer.docker.ubuntu: Selecting previously unselected package librtmp1:amd64.
    learn-packer.docker.ubuntu: Preparing to unpack .../09-librtmp1_2.4+20151223.gitfa8646d.1-2build4_amd64.deb ...
    learn-packer.docker.ubuntu: Unpacking librtmp1:amd64 (2.4+20151223.gitfa8646d.1-2build4) ...
    learn-packer.docker.ubuntu: Selecting previously unselected package libssh-4:amd64.
    learn-packer.docker.ubuntu: Preparing to unpack .../10-libssh-4_0.9.6-2ubuntu0.22.04.3_amd64.deb ...
    learn-packer.docker.ubuntu: Unpacking libssh-4:amd64 (0.9.6-2ubuntu0.22.04.3) ...
    learn-packer.docker.ubuntu: Selecting previously unselected package libcurl4:amd64.
    learn-packer.docker.ubuntu: Preparing to unpack .../11-libcurl4_7.81.0-1ubuntu1.16_amd64.deb ...
    learn-packer.docker.ubuntu: Unpacking libcurl4:amd64 (7.81.0-1ubuntu1.16) ...
    learn-packer.docker.ubuntu: Selecting previously unselected package curl.
    learn-packer.docker.ubuntu: Preparing to unpack .../12-curl_7.81.0-1ubuntu1.16_amd64.deb ...
    learn-packer.docker.ubuntu: Unpacking curl (7.81.0-1ubuntu1.16) ...
    learn-packer.docker.ubuntu: Selecting previously unselected package libldap-common.
    learn-packer.docker.ubuntu: Preparing to unpack .../13-libldap-common_2.5.18+dfsg-0ubuntu0.22.04.2_all.deb ...
    learn-packer.docker.ubuntu: Unpacking libldap-common (2.5.18+dfsg-0ubuntu0.22.04.2) ...
    learn-packer.docker.ubuntu: Selecting previously unselected package libsasl2-modules:amd64.
    learn-packer.docker.ubuntu: Preparing to unpack .../14-libsasl2-modules_2.1.27+dfsg2-3ubuntu1.2_amd64.deb ...
    learn-packer.docker.ubuntu: Unpacking libsasl2-modules:amd64 (2.1.27+dfsg2-3ubuntu1.2) ...
    learn-packer.docker.ubuntu: Setting up libpsl5:amd64 (0.21.0-1.2build2) ...
    learn-packer.docker.ubuntu: Setting up libbrotli1:amd64 (1.0.9-2build6) ...
    learn-packer.docker.ubuntu: Setting up libsasl2-modules:amd64 (2.1.27+dfsg2-3ubuntu1.2) ...
    learn-packer.docker.ubuntu: Setting up libnghttp2-14:amd64 (1.43.0-1ubuntu0.2) ...
    learn-packer.docker.ubuntu: Setting up libldap-common (2.5.18+dfsg-0ubuntu0.22.04.2) ...
    learn-packer.docker.ubuntu: Setting up libsasl2-modules-db:amd64 (2.1.27+dfsg2-3ubuntu1.2) ...
    learn-packer.docker.ubuntu: Setting up librtmp1:amd64 (2.4+20151223.gitfa8646d.1-2build4) ...
    learn-packer.docker.ubuntu: Setting up libsasl2-2:amd64 (2.1.27+dfsg2-3ubuntu1.2) ...
    learn-packer.docker.ubuntu: Setting up libssh-4:amd64 (0.9.6-2ubuntu0.22.04.3) ...
    learn-packer.docker.ubuntu: Setting up openssl (3.0.2-0ubuntu1.16) ...
    learn-packer.docker.ubuntu: Setting up publicsuffix (20211207.1025-1) ...
    learn-packer.docker.ubuntu: Setting up libldap-2.5-0:amd64 (2.5.18+dfsg-0ubuntu0.22.04.2) ...
    learn-packer.docker.ubuntu: Setting up ca-certificates (20230311ubuntu0.22.04.1) ...
    learn-packer.docker.ubuntu: debconf: unable to initialize frontend: Dialog
    learn-packer.docker.ubuntu: debconf: (TERM is not set, so the dialog frontend is not usable.)
    learn-packer.docker.ubuntu: debconf: falling back to frontend: Readline
    learn-packer.docker.ubuntu: debconf: unable to initialize frontend: Readline
    learn-packer.docker.ubuntu: debconf: (Can't locate Term/ReadLine.pm in @INC (you may need to install the Term::ReadLine module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.34.0 /usr/local/share/perl/5.34.0 /usr/lib/x86_64-linux-gnu/perl5/5.34 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl-base /usr/lib/x86_64-linux-gnu/perl/5.34 /usr/share/perl/5.34 /usr/local/lib/site_perl) at /usr/share/perl5/Debconf/FrontEnd/Readline.pm line 7.)
    learn-packer.docker.ubuntu: debconf: falling back to frontend: Teletype
    learn-packer.docker.ubuntu: Updating certificates in /etc/ssl/certs...
    learn-packer.docker.ubuntu: 137 added, 0 removed; done.
    learn-packer.docker.ubuntu: Setting up libcurl4:amd64 (7.81.0-1ubuntu1.16) ...
    learn-packer.docker.ubuntu: Setting up curl (7.81.0-1ubuntu1.16) ...
    learn-packer.docker.ubuntu: Processing triggers for libc-bin (2.35-0ubuntu3.8) ...
    learn-packer.docker.ubuntu: Processing triggers for ca-certificates (20230311ubuntu0.22.04.1) ...
    learn-packer.docker.ubuntu: Updating certificates in /etc/ssl/certs...
    learn-packer.docker.ubuntu: 0 added, 0 removed; done.
    learn-packer.docker.ubuntu: Running hooks in /etc/ca-certificates/update.d...
    learn-packer.docker.ubuntu: done.
    learn-packer.docker.ubuntu: Adding file to Docker Container
==> learn-packer.docker.ubuntu: Starting packer provisioner goss ...
==> learn-packer.docker.ubuntu: Configured to run on target system Linux/amd64
==> learn-packer.docker.ubuntu: Start execution of "curl/wget installation" ...
    learn-packer.docker.ubuntu: executing "curl -sL -o /tmp/goss-latest-Linux-amd64 https://github.com/goss-org/goss/releases/latest/download/goss-Linux-amd64 || wget -q -O /tmp/goss-latest-Linux-amd64 https://github.com/goss-org/goss/releases/latest/download/goss-Linux-amd64"
    learn-packer.docker.ubuntu: Creating download path "/tmp" ...
    learn-packer.docker.ubuntu: Installing goss version latest from https://github.com/goss-org/goss/releases/latest/download/goss-Linux-amd64
    learn-packer.docker.ubuntu: Trying to invoke goss ...
    learn-packer.docker.ubuntu: goss version v0.4.8
==> learn-packer.docker.ubuntu: Successfully finished "curl/wget installation"
==> learn-packer.docker.ubuntu: Start execution of "goss validate" ...
    learn-packer.docker.ubuntu: executing "/tmp/goss-latest-Linux-amd64 --gossfile="/tmp/goss.yaml" validate --retry-timeout=0s --sleep=1s"
    learn-packer.docker.ubuntu: Detecting wether "./goss.yaml" includes other gossfiles ...
    learn-packer.docker.ubuntu: Found [] referenced in "./goss.yaml"
    learn-packer.docker.ubuntu: Uploading [./goss.yaml] to target system ....
    learn-packer.docker.ubuntu: Uploading "./goss.yaml" to "/tmp/goss.yaml"
    learn-packer.docker.ubuntu: Running goss validate ...
    learn-packer.docker.ubuntu: .
    learn-packer.docker.ubuntu:
    learn-packer.docker.ubuntu: Total Duration: 0.000s
    learn-packer.docker.ubuntu: Count: 1, Failed: 0, Skipped: 0
    learn-packer.docker.ubuntu: goss validate finished
==> learn-packer.docker.ubuntu: Successfully finished "goss validate"
==> learn-packer.docker.ubuntu: Committing the container
    learn-packer.docker.ubuntu: Image ID: sha256:cd41ed9f46b454a8fbeab2692985d749ff7ad08c65259104372ae809f7622e30
==> learn-packer.docker.ubuntu: Killing the container: b7569cc4b587e7cb62dac8e7384b564bd96cdbffa87b8ddca1c495f7258e98bc
Build 'learn-packer.docker.ubuntu' finished after 27 seconds 269 milliseconds.

==> Wait completed after 27 seconds 269 milliseconds

==> Builds finished. The artifacts of successful builds are:
--> learn-packer.docker.ubuntu: Imported Docker image: sha256:cd41ed9f46b454a8fbeab2692985d749ff7ad08c65259104372ae809f7622e30

@F21
Copy link
Contributor

F21 commented Aug 12, 2024

Any reviewers who can review and approve this?

@btassone
Copy link
Contributor

btassone commented Aug 13, 2024

I'll take a look through the code @FalcoSuessgott @F21. It may take me a few days to get to it all as I am fairly busy on projects here at the University.

@btassone
Copy link
Contributor

Just to note: Added wiz vulnerability scanning tool to the university org, waiting on that to do its security scanning assessment before I approve. The scanning report should show up here on the PR.

@FalcoSuessgott
Copy link
Collaborator Author

Thanks so much for your time and effort.

@wiz-inc-91ace9494b
Copy link

wiz-inc-91ace9494b bot commented Aug 13, 2024

Wiz Scan Summary

Scan Module Critical High Medium Low Info Total
IaC Misconfigurations 0 0 0 0 0 0
Vulnerabilities 0 0 0 0 0 0
Sensitive Data 0 0 0 0 0 0
Secrets 0 0 0 0 0 0
Total 0 0 0 0 0 0

View scan details in Wiz

To detect these findings earlier in the dev lifecycle, try using Wiz Code VS Code Extension.

@FalcoSuessgott
Copy link
Collaborator Author

Alrighty, squashed the commits and removed the plugin docs stuff for now, as I want to have these in a separate PR. wiz found 1 vuln., which I fixed. Looking good from my side :)

@FalcoSuessgott FalcoSuessgott marked this pull request as draft August 21, 2024 06:03
@FalcoSuessgott
Copy link
Collaborator Author

found a bug when working with paths:

    amazon-ebs.ubuntu: Detecting wether "tmp/goss.yaml" includes other gossfiles ...
    amazon-ebs.ubuntu: Found [node_exporter_tests.yml] referenced in "tmp/goss.yaml"
    amazon-ebs.ubuntu: Uploading [tmp/goss.yaml node_exporter_tests.yml] to target system ....
    amazon-ebs.ubuntu: Uploading "tmp/goss.yaml" to "/tmp/tmp/goss.yaml"
    amazon-ebs.ubuntu: Uploading "node_exporter_tests.yml" to "/tmp/node_exporter_tests.yml"
    amazon-ebs.ubuntu: Running goss validate ...
    amazon-ebs.ubuntu: Error: no matched files were found: "/tmp/tmp/node_exporter_tests.yml"

gonna fix it and set it again for review

@btassone
Copy link
Contributor

found a bug when working with paths:

    amazon-ebs.ubuntu: Detecting wether "tmp/goss.yaml" includes other gossfiles ...
    amazon-ebs.ubuntu: Found [node_exporter_tests.yml] referenced in "tmp/goss.yaml"
    amazon-ebs.ubuntu: Uploading [tmp/goss.yaml node_exporter_tests.yml] to target system ....
    amazon-ebs.ubuntu: Uploading "tmp/goss.yaml" to "/tmp/tmp/goss.yaml"
    amazon-ebs.ubuntu: Uploading "node_exporter_tests.yml" to "/tmp/node_exporter_tests.yml"
    amazon-ebs.ubuntu: Running goss validate ...
    amazon-ebs.ubuntu: Error: no matched files were found: "/tmp/tmp/node_exporter_tests.yml"

gonna fix it and set it again for review

Did you ever fix that bug?

@FalcoSuessgott
Copy link
Collaborator Author

Hi @btassone I just started a new job so have been kind of busy. But will try to fix it this weekend, it was just a small thing when copying files to the target machine, nothing major. Will give you a heads up once done

@FalcoSuessgott
Copy link
Collaborator Author

FalcoSuessgott commented Oct 6, 2024

Stupid me, that bug was due to running packer from an outside directory so the provisioner couldn't find the files as the file paths were not correct anymore. I added a comprehensive getting started guide in the readme, which covers all that. (Preview: https://github.com/YaleUniversity/packer-plugin-goss/tree/refactor). With all that delay, I think the PR is ready to be merged and then published by pushing a v4.0.0 release :)

cc/ @F21 @btassone

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Passing ENV variable to goss plugin
3 participants