2019-09-05 09:34:05 -04:00
|
|
|
orbs:
|
|
|
|
win: circleci/windows@1.0.0
|
2020-03-12 05:36:10 -04:00
|
|
|
codecov: codecov/codecov@1.0.5
|
|
|
|
|
2019-09-05 09:34:05 -04:00
|
|
|
version: 2.1
|
|
|
|
|
|
|
|
executors:
|
|
|
|
golang:
|
|
|
|
docker:
|
2021-03-02 05:43:58 -05:00
|
|
|
- image: docker.mirror.hashicorp.services/circleci/golang:1.16
|
2020-06-29 09:12:03 -04:00
|
|
|
resource_class: medium+
|
2019-09-05 09:34:05 -04:00
|
|
|
darwin:
|
|
|
|
macos:
|
2020-09-30 11:22:13 -04:00
|
|
|
xcode: "12.0.0"
|
2019-09-05 09:34:05 -04:00
|
|
|
|
|
|
|
commands:
|
|
|
|
install-go-run-tests-unix:
|
|
|
|
parameters:
|
|
|
|
GOOS:
|
|
|
|
type: string
|
|
|
|
GOVERSION:
|
|
|
|
type: string
|
2021-04-21 04:52:55 -04:00
|
|
|
HOME:
|
|
|
|
type: string
|
|
|
|
default: "~"
|
2019-09-05 09:34:05 -04:00
|
|
|
steps:
|
|
|
|
- checkout
|
2021-04-21 04:52:55 -04:00
|
|
|
- run: curl https://dl.google.com/go/go<< parameters.GOVERSION >>.<< parameters.GOOS >>-amd64.tar.gz | tar -C << parameters.HOME >>/ -xz
|
|
|
|
- run: << parameters.HOME >>/go/bin/go test ./... -coverprofile=coverage.txt -covermode=atomic
|
2019-09-05 09:34:05 -04:00
|
|
|
install-go-run-tests-windows:
|
|
|
|
parameters:
|
|
|
|
GOVERSION:
|
|
|
|
type: string
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- run: curl https://dl.google.com/go/go<< parameters.GOVERSION >>.windows-amd64.zip --output ~/go<< parameters.GOVERSION >>.windows-amd64.zip
|
|
|
|
- run: unzip ~/go<< parameters.GOVERSION >>.windows-amd64.zip -d ~/
|
2020-03-12 05:36:10 -04:00
|
|
|
- run: ~/go/bin/go test ./... -coverprofile=coverage.txt -covermode=atomic
|
2019-09-05 09:34:05 -04:00
|
|
|
build-and-persist-packer-binary:
|
|
|
|
parameters:
|
|
|
|
GOOS:
|
|
|
|
type: string
|
2021-03-25 08:34:21 -04:00
|
|
|
GOARCH:
|
|
|
|
default: "amd64"
|
|
|
|
type: string
|
2019-09-05 09:34:05 -04:00
|
|
|
steps:
|
|
|
|
- checkout
|
2021-03-25 08:34:21 -04:00
|
|
|
- run: GOOS=<< parameters.GOOS >> GOARCH=<<parameters.GOARCH>> go build -ldflags="-s -w -X github.com/hashicorp/packer/version.GitCommit=${CIRCLE_SHA1}" -o ./pkg/packer_<< parameters.GOOS >>_<< parameters.GOARCH >> .
|
|
|
|
- run: zip ./pkg/packer_<< parameters.GOOS >>_<< parameters.GOARCH >>.zip ./pkg/packer_<< parameters.GOOS >>_<< parameters.GOARCH >>
|
|
|
|
- run: rm ./pkg/packer_<< parameters.GOOS >>_<< parameters.GOARCH >>
|
2019-09-05 09:34:05 -04:00
|
|
|
- persist_to_workspace:
|
|
|
|
root: .
|
|
|
|
paths:
|
|
|
|
- ./pkg/
|
2021-03-25 08:34:21 -04:00
|
|
|
|
2018-11-14 12:37:31 -05:00
|
|
|
# Golang CircleCI 2.0 configuration file
|
|
|
|
#
|
|
|
|
# Check https://circleci.com/docs/2.0/language-go/ for more details
|
|
|
|
jobs:
|
2019-09-05 09:34:05 -04:00
|
|
|
test-linux:
|
|
|
|
executor: golang
|
2020-04-16 05:58:54 -04:00
|
|
|
resource_class: large
|
2019-09-05 09:34:05 -04:00
|
|
|
working_directory: /go/src/github.com/hashicorp/packer
|
2018-11-14 12:37:31 -05:00
|
|
|
steps:
|
|
|
|
- checkout
|
2020-03-12 05:36:10 -04:00
|
|
|
- run: TESTARGS="-coverprofile=coverage.txt -covermode=atomic" make ci
|
|
|
|
- codecov/upload:
|
|
|
|
file: coverage.txt
|
2019-09-05 09:34:05 -04:00
|
|
|
test-darwin:
|
|
|
|
executor: darwin
|
2021-03-02 05:43:58 -05:00
|
|
|
working_directory: ~/go/github.com/hashicorp/packer
|
2019-09-05 09:34:05 -04:00
|
|
|
steps:
|
|
|
|
- install-go-run-tests-unix:
|
|
|
|
GOOS: darwin
|
2021-03-02 05:43:58 -05:00
|
|
|
GOVERSION: "1.16"
|
2020-03-12 05:36:10 -04:00
|
|
|
- codecov/upload:
|
|
|
|
file: coverage.txt
|
2019-09-05 09:34:05 -04:00
|
|
|
test-windows:
|
|
|
|
executor:
|
|
|
|
name: win/vs2019
|
|
|
|
shell: bash.exe
|
|
|
|
steps:
|
|
|
|
- install-go-run-tests-windows:
|
2021-03-02 05:43:58 -05:00
|
|
|
GOVERSION: "1.16"
|
2020-03-12 05:36:10 -04:00
|
|
|
- codecov/upload:
|
|
|
|
file: coverage.txt
|
|
|
|
check-lint:
|
|
|
|
executor: golang
|
2020-05-20 15:43:41 -04:00
|
|
|
resource_class: xlarge
|
2020-03-12 05:36:10 -04:00
|
|
|
steps:
|
|
|
|
- checkout
|
2020-04-14 06:03:22 -04:00
|
|
|
- run: git fetch --all
|
2020-03-12 05:36:10 -04:00
|
|
|
- run:
|
|
|
|
command: make ci-lint
|
|
|
|
no_output_timeout: 30m
|
2019-05-27 09:37:03 -04:00
|
|
|
check-fmt:
|
2019-09-05 09:34:05 -04:00
|
|
|
executor: golang
|
2019-05-27 09:37:03 -04:00
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- run: make fmt-check
|
2019-05-27 10:00:20 -04:00
|
|
|
check-generate:
|
2019-09-05 09:34:05 -04:00
|
|
|
executor: golang
|
|
|
|
working_directory: /go/src/github.com/hashicorp/packer
|
2019-05-27 10:00:20 -04:00
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- run: make generate-check
|
2019-05-01 07:50:57 -04:00
|
|
|
build_linux:
|
2019-09-05 09:34:05 -04:00
|
|
|
executor: golang
|
|
|
|
steps:
|
|
|
|
- build-and-persist-packer-binary:
|
|
|
|
GOOS: linux
|
2019-05-01 07:50:57 -04:00
|
|
|
build_windows:
|
2019-09-05 09:34:05 -04:00
|
|
|
executor: golang
|
|
|
|
working_directory: /go/src/github.com/hashicorp/packer
|
|
|
|
steps:
|
|
|
|
- build-and-persist-packer-binary:
|
|
|
|
GOOS: windows
|
2019-05-01 07:50:57 -04:00
|
|
|
build_darwin:
|
2019-09-05 09:34:05 -04:00
|
|
|
executor: golang
|
|
|
|
working_directory: /go/src/github.com/hashicorp/packer
|
|
|
|
steps:
|
|
|
|
- build-and-persist-packer-binary:
|
|
|
|
GOOS: darwin
|
2021-03-25 08:34:21 -04:00
|
|
|
build_darwin_arm64:
|
|
|
|
executor: golang
|
|
|
|
working_directory: /go/src/github.com/hashicorp/packer
|
|
|
|
steps:
|
|
|
|
- build-and-persist-packer-binary:
|
|
|
|
GOOS: darwin
|
|
|
|
GOARCH: arm64
|
2019-05-01 07:50:57 -04:00
|
|
|
build_freebsd:
|
2019-09-05 09:34:05 -04:00
|
|
|
executor: golang
|
|
|
|
working_directory: /go/src/github.com/hashicorp/packer
|
|
|
|
steps:
|
|
|
|
- build-and-persist-packer-binary:
|
|
|
|
GOOS: freebsd
|
2019-05-01 07:50:57 -04:00
|
|
|
build_solaris:
|
2019-09-05 09:34:05 -04:00
|
|
|
executor: golang
|
|
|
|
working_directory: /go/src/github.com/hashicorp/packer
|
|
|
|
steps:
|
|
|
|
- build-and-persist-packer-binary:
|
|
|
|
GOOS: solaris
|
2019-05-01 07:50:57 -04:00
|
|
|
build_openbsd:
|
2019-09-05 09:34:05 -04:00
|
|
|
executor: golang
|
|
|
|
working_directory: /go/src/github.com/hashicorp/packer
|
|
|
|
steps:
|
|
|
|
- build-and-persist-packer-binary:
|
|
|
|
GOOS: openbsd
|
2019-05-09 04:40:57 -04:00
|
|
|
store_artifacts:
|
2019-09-05 09:34:05 -04:00
|
|
|
executor: golang
|
2019-05-09 04:40:57 -04:00
|
|
|
steps:
|
|
|
|
- attach_workspace:
|
|
|
|
at: .
|
|
|
|
- store_artifacts:
|
|
|
|
path: ./pkg/
|
2019-05-09 05:37:34 -04:00
|
|
|
destination: /
|
2020-04-02 13:05:20 -04:00
|
|
|
build-website-docker-image:
|
|
|
|
docker:
|
2020-10-29 14:05:41 -04:00
|
|
|
- image: docker.mirror.hashicorp.services/circleci/buildpack-deps
|
2020-04-02 13:05:20 -04:00
|
|
|
shell: /usr/bin/env bash -euo pipefail -c
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- setup_remote_docker
|
|
|
|
- run:
|
|
|
|
name: Build Docker Image if Necessary
|
|
|
|
command: |
|
|
|
|
IMAGE_TAG=$(cat website/Dockerfile website/package-lock.json | sha256sum | awk '{print $1;}')
|
|
|
|
echo "Using $IMAGE_TAG"
|
|
|
|
if curl https://hub.docker.com/v2/repositories/hashicorp/packer-website/tags/$IMAGE_TAG -fsL > /dev/null; then
|
|
|
|
echo "Dependencies have not changed, not building a new website docker image."
|
|
|
|
else
|
|
|
|
cd website/
|
2020-10-29 14:05:41 -04:00
|
|
|
docker login -u $WEBSITE_DOCKER_USER -p $WEBSITE_DOCKER_PASS
|
2020-04-02 13:05:20 -04:00
|
|
|
docker build -t hashicorp/packer-website:$IMAGE_TAG .
|
|
|
|
docker tag hashicorp/packer-website:$IMAGE_TAG hashicorp/packer-website:latest
|
|
|
|
docker push hashicorp/packer-website
|
|
|
|
fi
|
2020-06-29 15:43:35 -04:00
|
|
|
algolia-index:
|
|
|
|
docker:
|
2020-10-29 14:05:41 -04:00
|
|
|
- image: docker.mirror.hashicorp.services/node:12
|
2020-06-29 15:43:35 -04:00
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- run:
|
|
|
|
name: Push content to Algolia Index
|
|
|
|
command: |
|
|
|
|
if [ "$CIRCLE_REPOSITORY_URL" != "git@github.com:hashicorp/packer.git" ]; then
|
|
|
|
echo "Not Packer OSS Repo, not indexing Algolia"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
cd website/
|
|
|
|
npm install
|
|
|
|
node scripts/index_search_content.js
|
2020-04-02 13:05:20 -04:00
|
|
|
|
2019-04-10 09:56:04 -04:00
|
|
|
workflows:
|
|
|
|
version: 2
|
2019-09-05 09:34:05 -04:00
|
|
|
test:
|
|
|
|
jobs:
|
|
|
|
- test-linux
|
|
|
|
- test-darwin
|
|
|
|
- test-windows
|
|
|
|
check-code:
|
2019-04-10 09:56:04 -04:00
|
|
|
jobs:
|
2020-03-12 05:36:10 -04:00
|
|
|
- check-lint
|
2019-05-27 09:37:03 -04:00
|
|
|
- check-fmt
|
2019-05-27 10:00:20 -04:00
|
|
|
- check-generate
|
2019-09-05 09:34:05 -04:00
|
|
|
build_packer_binaries:
|
|
|
|
jobs:
|
2020-06-23 22:31:32 -04:00
|
|
|
- build_linux
|
|
|
|
- build_darwin
|
2021-03-25 08:34:21 -04:00
|
|
|
- build_darwin_arm64
|
2020-06-23 22:31:32 -04:00
|
|
|
- build_windows
|
|
|
|
- build_freebsd
|
|
|
|
- build_openbsd
|
|
|
|
- build_solaris
|
2019-05-09 09:03:54 -04:00
|
|
|
- store_artifacts:
|
2019-05-09 04:40:57 -04:00
|
|
|
requires:
|
|
|
|
- build_linux
|
|
|
|
- build_darwin
|
2021-03-25 08:34:21 -04:00
|
|
|
- build_darwin_arm64
|
2019-05-09 04:40:57 -04:00
|
|
|
- build_windows
|
|
|
|
- build_freebsd
|
|
|
|
- build_openbsd
|
|
|
|
- build_solaris
|
2020-06-29 15:43:35 -04:00
|
|
|
website:
|
2020-04-02 13:05:20 -04:00
|
|
|
jobs:
|
|
|
|
- build-website-docker-image:
|
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
only:
|
|
|
|
- master
|
2020-06-29 15:43:35 -04:00
|
|
|
- algolia-index:
|
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
only:
|
|
|
|
- stable-website
|