mirror of
https://git.vectorsigma.ru/public/atlantis.git
synced 2026-08-05 04:18:42 +00:00
feat: add goss testing for the docker image (#4459)
Co-authored-by: Rui Chen <rui@chenrui.dev>
This commit is contained in:
committed by
GitHub
parent
821de05ddd
commit
8c5bb21ffa
45
.github/workflows/atlantis-image.yml
vendored
45
.github/workflows/atlantis-image.yml
vendored
@@ -148,6 +148,51 @@ jobs:
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
outputs: type=image,name=target,annotation-index.org.opencontainers.image.description=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.description'] }}
|
||||
|
||||
test:
|
||||
needs: [changes]
|
||||
if: needs.changes.outputs.should-run-build == 'true'
|
||||
name: Test Image With Goss
|
||||
runs-on: ubuntu-22.04
|
||||
strategy:
|
||||
matrix:
|
||||
image_type: [alpine, debian]
|
||||
env:
|
||||
# Set docker repo to either the fork or the main repo where the branch exists
|
||||
DOCKER_REPO: ghcr.io/${{ github.repository }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3
|
||||
# https://github.com/docker/build-push-action/issues/761#issuecomment-1575006515
|
||||
with:
|
||||
driver-opts: |
|
||||
image=moby/buildkit:v0.13.2
|
||||
|
||||
- name: "Build and load into Docker"
|
||||
if: contains(fromJson('["push", "pull_request"]'), github.event_name)
|
||||
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5
|
||||
with:
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
context: .
|
||||
build-args: |
|
||||
ATLANTIS_BASE_TAG_TYPE=${{ matrix.image_type }}
|
||||
push: false
|
||||
load: true
|
||||
tags: "${{ env.DOCKER_REPO }}:goss-test"
|
||||
target: ${{ matrix.image_type }}
|
||||
|
||||
- name: "Setup Goss"
|
||||
uses: e1himself/goss-installation-action@fbb6fb55d3e59c96045b2500eeb8ce0995d99ac1 # v1.2.1
|
||||
with:
|
||||
version: "v0.4.7"
|
||||
|
||||
- name: Execute Goss tests
|
||||
run: |
|
||||
dgoss run --rm ${{ env.DOCKER_REPO }}:goss-test bash -c 'while true; do sleep 1; done;'
|
||||
|
||||
skip-build:
|
||||
needs: [changes]
|
||||
if: needs.changes.outputs.should-run-build == 'false'
|
||||
|
||||
37
goss.yaml
Normal file
37
goss.yaml
Normal file
@@ -0,0 +1,37 @@
|
||||
# See: https://github.com/goss-org/goss/blob/master/docs/gossfile.md
|
||||
|
||||
command:
|
||||
# ensure atlantis is available
|
||||
atlantis-available:
|
||||
exec: "atlantis version"
|
||||
exit-status: 0
|
||||
stdout: []
|
||||
stderr: []
|
||||
|
||||
# ensure conftest is available
|
||||
conftest-available:
|
||||
exec: "conftest -v"
|
||||
exit-status: 0
|
||||
stdout: []
|
||||
stderr: []
|
||||
|
||||
# ensure git-lfs is available
|
||||
git-lfs-available:
|
||||
exec: "git-lfs -v"
|
||||
exit-status: 0
|
||||
stdout: []
|
||||
stderr: []
|
||||
|
||||
# ensure terraform is available
|
||||
terraform-available:
|
||||
exec: "terraform version"
|
||||
exit-status: 0
|
||||
stdout: []
|
||||
stderr: []
|
||||
|
||||
# ensure tofu binary is available
|
||||
tofu-available:
|
||||
exec: "tofu version"
|
||||
exit-status: 0
|
||||
stdout: []
|
||||
stderr: []
|
||||
Reference in New Issue
Block a user