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

deploy using terraform #175

Merged
merged 5 commits into from
Apr 27, 2023
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: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ jobs:
steps:
- uses: actions/setup-go@v2
with:
go-version: 1.18
go-version: '1.20.x'
- uses: actions/checkout@v3
- run: go build ./...
30 changes: 19 additions & 11 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,15 @@ jobs:
permissions:
id-token: write
contents: read
env:
KO_DOCKER_REPO=gcr.io/kontaindotme
steps:
- uses: actions/checkout@v3

# Install tools.
- uses: actions/setup-go@v2
with:
go-version: 1.18
- uses: imjasonh/setup-ko@v0.6
env:
KO_DOCKER_REPO: gcr.io/kontaindotme
go-version: '1.20.x'
- uses: hashicorp/setup-terraform@v2
- uses: imjasonh/setup-crane@v0.1

# Setup OIDC->SA auth
Expand All @@ -35,11 +34,20 @@ jobs:
- uses: google-github-actions/setup-gcloud@v0.6.0
with:
project_id: kontaindotme
install_components: beta

# Deploy and test.
- run: ./deploy.sh
env:
KOCACHE: ~/ko
- name: Terraform Plan
run: |
cat > terraform.tfvars <<EOF
project_id = "${{ env.PROJECT_ID }}"
EOF

terraform init
terraform plan -input=false -lock=false -out=plan.tmp
terraform show -no-color plan.tmp

- name: Terraform Apply
if: ${{ github.event_name == 'push' }}
run: terraform apply -auto-approve -input=false plan.tmp

- run: ./test.sh

38 changes: 10 additions & 28 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,20 @@
# Local .terraform directories
**/.terraform/*

# .tfstate files
*.tfstate
*.tfstate.*

# Crash log files
crash.log
crash.*.log

# Exclude all .tfvars files, which are likely to contain sentitive data, such as
# password, private keys, and other secrets. These should not be part of version
# control as they are data points which are potentially sensitive and subject
# Exclude all .tfvars files, which are likely to contain sensitive data, such as
# password, private keys, and other secrets. These should not be part of version
# control as they are data points which are potentially sensitive and subject
# to change depending on the environment.
#
*.tfvars
*.tfvars.json

# Ignore override files as they are usually used to override resources locally and so
# are not checked in
Expand All @@ -21,32 +26,9 @@ override.tf.json
*_override.tf
*_override.tf.json

# Include override files you do wish to add to version control using negated pattern
#
# !example_override.tf

# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
# example: *tfplan*

# Ignore CLI configuration files
.terraformrc
terraform.rc

###
# https://github.com/github/gitignore/blob/master/Go.gitignore

# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories (remove the comment below to include it)
# vendor/
plan.tmp
7 changes: 0 additions & 7 deletions .ko.yaml

This file was deleted.

43 changes: 43 additions & 0 deletions .terraform.lock.hcl

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

3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ These include:
APK packages, using [`apko`](https://apko.dev).
* [`buildpack.kontain.me`](./cmd/buildpack), which builds a GitHub repo using [CNCF
Buildpacks](https://buildpacks.io).
* [`estargz.kontain.me`](./cmd/estargz), which optimizes an image's layers for
partial image pulls using
[estargz](https://github.com/containerd/stargz-snapshotter).
* [`wait.kontain.me`](./cmd/wait), which enqueues a background task to serve a
random image after some amount of time.

Expand Down
5 changes: 0 additions & 5 deletions cmd/apko/Dockerfile.base

This file was deleted.

15 changes: 0 additions & 15 deletions cmd/apko/deploy.sh

This file was deleted.

1 change: 0 additions & 1 deletion cmd/apko/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ func (s *server) build(ctx context.Context, ic types.ImageConfiguration) (v1.Ima

bc, err := build.New(wd,
build.WithImageConfiguration(ic),
build.WithProot(true),
build.WithArch(amd64), // TODO: multiarch
build.WithBuildDate(time.Time{}.Format(time.RFC3339)),
build.WithAssertions(build.RequireGroupFile(true), build.RequirePasswdFile(true)))
Expand Down
14 changes: 0 additions & 14 deletions cmd/buildpack/deploy.sh

This file was deleted.

31 changes: 0 additions & 31 deletions cmd/cowsay/README.md

This file was deleted.

14 changes: 0 additions & 14 deletions cmd/cowsay/deploy.sh

This file was deleted.

83 changes: 0 additions & 83 deletions cmd/cowsay/main.go

This file was deleted.

20 changes: 0 additions & 20 deletions cmd/estargz/README.md

This file was deleted.

14 changes: 0 additions & 14 deletions cmd/estargz/deploy.sh

This file was deleted.

Loading