diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index e7529a4..5e5e653 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -1,5 +1,5 @@ -Contributing to hashicorp-aws Plugin -==================================== +Contributing to paion-data Plugin +================================= **First:** if you're unsure or afraid of _anything_, just ask or submit the issue or pull request anyway. You won't be yelled at for giving your best effort. The worst that can happen is that you'll be politely asked to change something. @@ -46,30 +46,30 @@ Setting up Go ------------- If you have never worked with Go before, you will have to install its runtime in order to build packer with the -hashicorp-aws plugin. +paion-data plugin. This project always releases from the latest version of golang. [Install go](https://golang.org/doc/install#install) to properly build from source, you need to have golang >= 1.21 -Setting up hashicorp-aws Plugin for Dev ---------------------------------------- +Setting up paion-data Plugin for Dev +------------------------------------ -With Go installed, you can already `go get` the hashicorp-aws plugin and `make dev` in order to compile and test it. +With Go installed, you can already `go get` the paion-data plugin and `make dev` in order to compile and test it. These instructions target POSIX-like environments (macOS, Linux, Cygwin, etc.) so you may need to adjust them for Windows or other shells. -1. Download the hashicorp-aws plugin source (and its dependencies) by running - `go get github.com/QubitPi/packer-plugin-hashicorp-aws`. This will download the source to - `$GOPATH/src/github.com/QubitPi/packer-plugin-hashicorp-aws`. -2. When working on the hashicorp-aws plugin, first `cd $GOPATH/src/github.com/QubitPi/packer-plugin-hashicorp-aws` - so you can run `make dev` and easily access other files. `make dev` will build the packer-plugin-hashicorp-aws binary +1. Download the paion-data plugin source (and its dependencies) by running + `go get github.com/paion-data/packer-plugin-paion-data`. This will download the source to + `$GOPATH/src/github.com/paion-data/packer-plugin-paion-data`. +2. When working on the paion-data plugin, first `cd $GOPATH/src/github.com/paion-data/packer-plugin-paion-data` + so you can run `make dev` and easily access other files. `make dev` will build the packer-plugin-paion-data binary and install it under `$HOME/.packer.d/plugins/`. -3. Make your changes to the hashicorp-aws plugin source. You can run `make dev` to build and install locally, and +3. Make your changes to the paion-data plugin source. You can run `make dev` to build and install locally, and `make test` to run unit tests. Any compilation errors will be shown when the binaries are rebuilding. If you don't - have `make` you can simply run `go build -o packer-plugin-hashicorp-aws` from the project root, and - `mv packer-plugin-hashicorp-aws ~/.packer.d/plugins/packer-plugin-hashicorp-aws` to install the plugin. -4. After building the hashicorp-aws plugin successfully, use the latest version of Packer to build a machine and verify - your changes. In the [example folder](https://github.com/QubitPi/packer-plugin-hashicorp-aws/blob/main/example) we + have `make` you can simply run `go build -o packer-plugin-paion-data` from the project root, and + `mv packer-plugin-paion-data ~/.packer.d/plugins/packer-plugin-paion-data` to install the plugin. +4. After building the paion-data plugin successfully, use the latest version of Packer to build a machine and verify + your changes. In the [example folder](https://github.com/paion-data/packer-plugin-paion-data/blob/main/example) we provide a basic template. Comment out the `packer {}` block to force Packer use the development binary installed in the previous step. 5. If everything works well and the tests pass, run `go fmt ./...` on your code before submitting a pull-request. @@ -77,7 +77,7 @@ Windows or other shells. ### Opening a Pull Request Thank you for contributing! When you are ready to open a pull-request, you will -need to [fork the hashicorp-aws plugin](https://github.com/QubitPi/packer-plugin-hashicorp-aws/fork), push your +need to [fork the paion-data plugin](https://github.com/paion-data/packer-plugin-paion-data/fork), push your changes to your fork, and then open a pull-request. For example, my github username is `myuser`, so I would do the following: @@ -85,7 +85,7 @@ For example, my github username is `myuser`, so I would do the following: ``` git checkout -b f-my-feature # Develop a patch. -git push https://github.com/myuser/packer-plugin-hashicorp-aws f-my-feature +git push https://github.com/myuser/packer-plugin-paion-data f-my-feature ``` From there, open your fork in your browser to open a new pull-request. @@ -141,12 +141,12 @@ and please know that we appreciate the time and energy you put into the project. #### Working on forks -The easiest way to work on a fork is to set it as a remote of the hashicorp-aws plugin project. +The easiest way to work on a fork is to set it as a remote of the paion-data plugin project. 1. Navigate to the code: ```shell - cd $GOPATH/src/github.com/QubitPi/packer-plugin-hashicorp-aws + cd $GOPATH/src/github.com/paion-data/packer-plugin-paion-data ``` 2. Add the remote by running: @@ -158,7 +158,7 @@ The easiest way to work on a fork is to set it as a remote of the hashicorp-aws For example: ```shell - git remote add myuser https://github.com/myuser/packer-plugin-hashicorp-aws.git + git remote add myuser https://github.com/myuser/packer-plugin-paion-data.git ``` 3. Checkout a feature branch: @@ -188,7 +188,7 @@ recommended but not required. Use `go get ` to add dependencies to the project. See [go mod quick start](https://github.com/golang/go/wiki/Modules#quick-start) for examples. -Please only apply the minimal vendor changes to get your PR to work. The hashicorp-aws plugin does not attempt to track +Please only apply the minimal vendor changes to get your PR to work. The paion-data plugin does not attempt to track the latest version for each dependency. #### HCL2 Spec Code Generation diff --git a/.github/docker/Dockerfile b/.github/docker/Dockerfile deleted file mode 100644 index dbd5401..0000000 --- a/.github/docker/Dockerfile +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright Jiaqi Liu -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -FROM ubuntu:22.04 - -LABEL maintainer="Jiaqi (Jack) Liu" -LABEL maintainer-email="jack20220723@gmail.com" - -RUN apt update -RUN apt upgrade -y -RUN apt install software-properties-common -y -RUN apt install wget curl sudo -y diff --git a/.github/docker/README.md b/.github/docker/README.md deleted file mode 100644 index a9154a2..0000000 --- a/.github/docker/README.md +++ /dev/null @@ -1,39 +0,0 @@ -Packer Plugin hashicorp-aws Acceptance Tests Base Image -======================================================= - -[![badge](https://img.shields.io/badge/DockerHub-2596EC?style=for-the-badge&logo=docker&logoColor=white)](https://hub.docker.com/r/jack20191124/packer-plugin-hashicorp-aws-acc-test-base) - -This image is used by [packer-plugin-hashicorp-aws](https://github.com/QubitPi/packer-plugin-hashicorp-aws) to perform -acceptance tests in Docker without the need to test against AWS, which -[requires a real AWS credentials](https://developer.hashicorp.com/packer/tutorials/aws-get-started/aws-get-started-build-image#authenticate-to-aws) - -To use this image, the test fixture can be - -``` -packer { - required_plugins { - docker = { - version = ">= 0.0.7" - source = "github.com/hashicorp/docker" - } - } -} - -source "docker" "hashicorp-aws" { - image = "jack20191124/packer-plugin-hashicorp-aws-acc-test-base:latest" - discard = true -} - -build { - sources = [ - "source.docker.hashicorp-aws" - ] - - provisioner "hashicorp-aws-webservice-provisioner" { - homeDir = "/" - warSource = "my-webservice.war" - } -} -``` - -In this example, we are testing a [webservice provisioner](../../docs/provisioners/webservice.mdx) in Docker diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 73e222b..59d8650 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -59,38 +59,9 @@ jobs: make build make test - docker-image: - name: Publish test docker images for acceptance tests - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - name: Login to DockerHub - uses: docker/login-action@v2 - with: - username: jack20191124 - password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Push image to DockerHub - uses: docker/build-push-action@v3 - with: - context: .github/docker/ - push: true - tags: jack20191124/packer-plugin-hashicorp-aws-acc-test-base:latest - - name: Push image Description - uses: peter-evans/dockerhub-description@v4 - with: - username: jack20191124 - password: ${{ secrets.DOCKERHUB_TOKEN }} - repository: jack20191124/packer-plugin-hashicorp-aws-acc-test-base - readme-filepath: .github/docker/README.md - acceptance-tests: name: Packer Plugin Acceptance Tests - needs: [tests, docker-image] + needs: tests outputs: outcome: ${{ job.status }} continue-on-error: true @@ -103,31 +74,16 @@ jobs: - name: Install Packer uses: hashicorp/setup-packer@main - name: Build plugin - run: go build -ldflags="-X github.com/QubitPi/packer-plugin-hashicorp-aws/version.VersionPrerelease=dev" -o packer-plugin-hashicorp-aws + run: go build -ldflags="-X github.com/paion-data/packer-plugin-paion-data/version.VersionPrerelease=dev" -o packer-plugin-paion-data - name: Install dependencies - run: | - packer plugins install github.com/hashicorp/amazon - packer plugins install github.com/hashicorp/docker + run: packer plugins install github.com/hashicorp/docker - name: Install plugin - run: packer plugins install --path packer-plugin-hashicorp-aws github.com/QubitPi/hashicorp-aws + run: packer plugins install --path packer-plugin-paion-data github.com/paion-data/paion-data - name: Run all acceptance tests run: PACKER_ACC=1 go test -count 1 -v ./... -timeout=120m - env: - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} release: needs: [acceptance-tests] if: ${{ github.ref == 'refs/heads/master' && github.repository != 'QubitPi/hashicorp-packer-plugin-scaffolding' }} uses: ./.github/workflows/release.yml secrets: inherit - - slack-notification: - name: Send Slack Notification - if: github.ref != 'refs/heads/master' - needs: acceptance-tests - uses: QubitPi/hashicorp-aws/.github/workflows/slack-notification.yml@master - with: - job-status: ${{ needs.acceptance-tests.outputs.outcome }} - secrets: - slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9f706ae..3d0ec3d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,7 +3,7 @@ # # This uses an action (hashicorp/ghaction-import-gpg) that assumes you set your # private key in the `GPG_PRIVATE_KEY` secret and passphrase in the `GPG_PASSPHRASE` -# secret. See https://packer.qubitpi.org/packer/docs/plugins/creation#creating-a-github-release for more +# secret. See https://developer.hashicorp.com/packer/docs/plugins/creation#creating-a-github-release for more # details on how to create `GPG_PRIVATE_KEY` and `GPG_PASSPHRASE`. If one would rather own their own GPG handling, # please fork this action or use an alternative one for key handling. # @@ -73,12 +73,3 @@ jobs: GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} API_VERSION: ${{ steps.plugin_describe.outputs.api_version }} - - slack-notification: - name: Send Slack Notification - needs: goreleaser - uses: QubitPi/hashicorp-aws/.github/workflows/slack-notification.yml@master - with: - job-status: ${{ needs.goreleaser.outputs.outcome }} - secrets: - slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }} diff --git a/.gitignore b/.gitignore index 9aff17c..9c59b4f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ main -packer-plugin-hashicorp-aws +packer-plugin-paion-data **/packer_log*.txt **/git_*test.pkr.hcl crash.log diff --git a/.web-docs/README.md b/.web-docs/README.md index be4b906..9910606 100644 --- a/.web-docs/README.md +++ b/.web-docs/README.md @@ -14,9 +14,9 @@ To install this plugin, copy and paste this code into Packer configuration, then ```hcl packer { required_plugins { - hashicorp-aws = { + paion-data = { version = ">= 0.0.1" - source = "github.com/QubitPi/hashicorp-aws" + source = "github.com/paion-data/paion-data" } } } @@ -25,7 +25,7 @@ packer { Alternatively, we can use `packer plugins install` to manage installation of this plugin. ```sh -$ packer plugins install github.com/QubitPi/hashicorp-aws +$ packer plugins install github.com/paion-data/paion-data ``` ### Components @@ -38,7 +38,7 @@ They enable 1. programmatic configuration management which is not possible with HCL, and 2. code reuse -The business logics that satisfy the two criteria above are offered as the hashicorp-aws provisioners below: +The business logics that satisfy the two criteria above are offered as the paion-data provisioners below: - [React App](./provisioners/react.mdx) - [Sonatype Nexus Repository](./provisioners/sonatype-nexus-repository.mdx) diff --git a/.web-docs/components/provisioner/react/README.md b/.web-docs/components/provisioner/react/README.md index e3f6e94..67a2d1b 100644 --- a/.web-docs/components/provisioner/react/README.md +++ b/.web-docs/components/provisioner/react/README.md @@ -14,10 +14,10 @@ The `react` provisioner is used to install a compiled React-based APP in AWS AMI If it is relative, it is relative to the working directory when Packer is executed. - `appDomain` (string) - the SSL-enabled domain that will serve the deployed HTTP React APP instance. - `sslCertBase64` (string) - is a __base64 encoded__ string of the content of - [SSL certificate file](https://hashicorp-aws.com/docs/setup#optional-setup-ssl) for the SSL-enabled domain, for + [SSL certificate file](https://immutable-infrastructure.com/docs/setup#optional-setup-ssl) for the SSL-enabled domain, for example `app.mycompany.com` given the `appDomain` is `app.mycompany.com`. - `sslCertKeyBase64` (string) - is a __base64 encoded__ string of the content of - [SSL certificate key file](https://hashicorp-aws.com/docs/setup#optional-setup-ssl) for the SSL-enabled domain, for + [SSL certificate key file](https://immutable-infrastructure.com/docs/setup#optional-setup-ssl) for the SSL-enabled domain, for example `app.mycompany.com` given the `appDomain` is `app.mycompany.com`. @@ -51,8 +51,8 @@ packer { } } -source "amazon-ebs" "hashicorp-aws" { - ami_name = "packer-plugin-hashicorp-aws-acc-test-ami-react" +source "amazon-ebs" "paion-data" { + ami_name = "packer-plugin-paion-data-acc-test-ami-react" force_deregister = "true" force_delete_snapshot = "true" @@ -78,10 +78,10 @@ source "amazon-ebs" "hashicorp-aws" { build { sources = [ - "source.amazon-ebs.hashicorp-aws" + "source.amazon-ebs.paion-data" ] - provisioner "hashicorp-aws-react-provisioner" { + provisioner "paion-data-react-provisioner" { distSource = "./dist" homeDir = "/home/ubuntu" sslCertBase64 = "YXNkZnNnaHRkeWhyZXJ3ZGZydGV3ZHNmZ3RoeTY0cmV3ZGZyZWd0cmV3d2ZyZw==" diff --git a/.web-docs/components/provisioner/sonatype-nexus-repository/README.md b/.web-docs/components/provisioner/sonatype-nexus-repository/README.md index 66cb990..0c76343 100644 --- a/.web-docs/components/provisioner/sonatype-nexus-repository/README.md +++ b/.web-docs/components/provisioner/sonatype-nexus-repository/README.md @@ -12,10 +12,10 @@ The `sonatype-nexus-repository` provisioner is used to install Sonatype Nexus Re - `sonatypeNexusRepositoryDomain` (string) - the SSL-enabled domain that will serve the deployed HTTP Nexus instance. - `sslCertBase64` (string) - is a __base64 encoded__ string of the content of - [SSL certificate file](https://hashicorp-aws.com/docs/setup#optional-setup-ssl) for the SSL-enabled domain, for + [SSL certificate file](https://immutable-infrastructure.com/docs/setup#optional-setup-ssl) for the SSL-enabled domain, for example `nexus.mycompany.com` given the `sonatypeNexusRepositoryDomain` is `nexus.mycompany.com`. - `sslCertKeyBase64` (string) - is a __base64 encoded__ string of the content of - [SSL certificate key file](https://hashicorp-aws.com/docs/setup#optional-setup-ssl) for the SSL-enabled domain, for + [SSL certificate key file](https://immutable-infrastructure.com/docs/setup#optional-setup-ssl) for the SSL-enabled domain, for example `nexus.mycompany.com` given the `sonatypeNexusRepositoryDomain` is `nexus.mycompany.com`.