Skip to content

Commit 46e3002

Browse files
committed
first commit
0 parents  commit 46e3002

File tree

137 files changed

+66026
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

137 files changed

+66026
-0
lines changed

.github/dependabot.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: gomod
4+
directory: '/'
5+
schedule:
6+
interval: weekly
7+
open-pull-requests-limit: 10
8+
- package-ecosystem: github-actions
9+
directory: '/'
10+
schedule:
11+
interval: daily
12+
open-pull-requests-limit: 10

.github/workflows/e2e.yaml

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
name: Deployments tests (E2E)
2+
on:
3+
pull_request:
4+
5+
concurrency:
6+
group: e2e-tests-plugin-env-${{ github.ref }}
7+
cancel-in-progress: true
8+
9+
env:
10+
INTERNAL_DOCKER_REPO: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com
11+
ENV_JOB_IMAGE: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com/plugin-env-tests:ci.${{ github.sha }}
12+
BASE_IMAGE_NAME: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com/test-base-image:ci.${{ github.sha }}
13+
PLUGIN_IMAGE: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com/plugin
14+
PLUGIN_VERSION: develop
15+
SELECTED_NETWORKS: SIMULATED
16+
PLUGIN_COMMIT_SHA: ${{ github.sha }}
17+
PLUGIN_ENV_USER: ${{ github.actor }}
18+
TEST_LOG_LEVEL: debug
19+
20+
jobs:
21+
build_tests:
22+
runs-on: ubuntu-latest
23+
environment: integration
24+
permissions:
25+
id-token: write
26+
contents: read
27+
steps:
28+
- uses: actions/checkout@v3
29+
- name: Build Base Image
30+
uses: goplugin/pluginv3.0-github-actions/docker/build-push@ce87f8986ca18336cc5015df75916c2ec0a7c4b3 # v2.1.2
31+
with:
32+
tags: ${{ env.BASE_IMAGE_NAME }}
33+
file: Dockerfile.base
34+
AWS_REGION: ${{ secrets.QA_AWS_REGION }}
35+
AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }}
36+
- name: Base Image Built
37+
run: |
38+
echo "### plugin image used for this test run :link:" >>$GITHUB_STEP_SUMMARY
39+
echo "\`${{ env.PLUGIN_VERSION }}\`" >>$GITHUB_STEP_SUMMARY
40+
echo "### test-base-image image tag for this test run :ship:" >>$GITHUB_STEP_SUMMARY
41+
echo "\`ci.${{ github.sha }}\`" >>$GITHUB_STEP_SUMMARY
42+
- name: Build Test Runner
43+
uses: goplugin/pluginv3.0-github-actions/docker/build-push@ce87f8986ca18336cc5015df75916c2ec0a7c4b3 # v2.1.2
44+
with:
45+
tags: ${{ env.ENV_JOB_IMAGE }}
46+
file: Dockerfile
47+
build-args: |
48+
BASE_IMAGE=${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com/test-base-image
49+
IMAGE_VERSION=ci.${{ github.sha }}
50+
AWS_REGION: ${{ secrets.QA_AWS_REGION }}
51+
AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }}
52+
- name: Test Image Built
53+
run: |
54+
echo "### plugin-env-tests image tag for this test run :ship:" >>$GITHUB_STEP_SUMMARY
55+
echo "\`ci.${{ github.sha }}\`" >>$GITHUB_STEP_SUMMARY
56+
e2e_tests:
57+
runs-on: ubuntu-latest
58+
environment: integration
59+
permissions:
60+
id-token: write
61+
contents: read
62+
env:
63+
TEST_SUITE: local-runner
64+
steps:
65+
- uses: actions/checkout@v3
66+
- name: Run Tests
67+
uses: goplugin/pluginv3.0-github-actions/plugin-testing-framework/run-tests@ce87f8986ca18336cc5015df75916c2ec0a7c4b3 # v2.1.2
68+
with:
69+
cl_repo: ${{ env.PLUGIN_IMAGE }}
70+
cl_image_tag: ${{ env.PLUGIN_VERSION }}
71+
test_command_to_run: unset ENV_JOB_IMAGE && make test_e2e_ci
72+
test_download_vendor_packages_command: go mod download
73+
artifacts_location: ./e2e/logs
74+
publish_check_name: E2E Test Results
75+
token: ${{ secrets.GITHUB_TOKEN }}
76+
go_mod_path: go.mod
77+
QA_AWS_REGION: ${{ secrets.QA_AWS_REGION }}
78+
QA_AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }}
79+
QA_KUBECONFIG: ${{ secrets.QA_KUBECONFIG }}
80+
- name: Upload test log
81+
uses: actions/upload-artifact@v3
82+
if: failure()
83+
with:
84+
name: test-log
85+
path: /tmp/gotest.log
86+
87+
e2e_remote_runner_tests:
88+
runs-on: ubuntu-latest
89+
environment: integration
90+
needs: [build_tests]
91+
permissions:
92+
id-token: write
93+
contents: read
94+
env:
95+
TEST_SUITE: remote-runner
96+
TEST_TRIGGERED_BY: plugin-env-remote-runner-ci
97+
steps:
98+
- uses: actions/checkout@v3
99+
- name: Run Remote Runner Tests
100+
uses: goplugin/pluginv3.0-github-actions/plugin-testing-framework/run-tests@ce87f8986ca18336cc5015df75916c2ec0a7c4b3 # v2.1.2
101+
with:
102+
cl_repo: ${{ env.PLUGIN_IMAGE }}
103+
cl_image_tag: ${{ env.PLUGIN_VERSION }}
104+
test_command_to_run: make test_e2e_ci_remote_runner
105+
test_download_vendor_packages_command: go mod download
106+
artifacts_location: ./e2e/logs
107+
publish_check_name: E2E Remote Runner Test Results
108+
token: ${{ secrets.GITHUB_TOKEN }}
109+
go_mod_path: go.mod
110+
QA_AWS_REGION: ${{ secrets.QA_AWS_REGION }}
111+
QA_AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }}
112+
QA_KUBECONFIG: ${{ secrets.QA_KUBECONFIG }}
113+
- name: Upload test log
114+
uses: actions/upload-artifact@v2
115+
if: failure()
116+
with:
117+
name: remote-runner-test-log
118+
path: /tmp/remoterunnergotest.log

.github/workflows/go_test.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Go test
2+
on:
3+
pull_request:
4+
jobs:
5+
unit_test:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/checkout@v3
9+
- name: Set up Go
10+
uses: actions/setup-go@v3
11+
with:
12+
go-version-file: "go.mod"
13+
check-latest: true
14+
- name: Test config
15+
run: make test

.github/workflows/lint.yaml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Linting
2+
on:
3+
pull_request:
4+
jobs:
5+
tools:
6+
name: Get Tool tool-versions
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Check out Code
10+
uses: actions/checkout@v3
11+
- uses: goplugin/tool-versions-to-env-action@v1.0.8
12+
id: tool-versions
13+
outputs:
14+
golangci-lint-version: ${{ steps.tool-versions.outputs.golangci-lint_version }}
15+
golangci:
16+
name: Linting
17+
runs-on: ubuntu-latest
18+
needs: [tools]
19+
steps:
20+
- name: Check out Code
21+
uses: actions/checkout@v3
22+
- name: Install Go
23+
uses: actions/setup-go@v3
24+
with:
25+
go-version-file: "go.mod"
26+
check-latest: true
27+
- name: golangci-lint
28+
uses: golangci/golangci-lint-action@v3
29+
with:
30+
version: v${{ needs.tools.outputs.golangci-lint-version }}
31+
32+
vulnerabilities-check:
33+
name: Check for Vulnerabilities
34+
runs-on: ubuntu-latest
35+
needs: [tools]
36+
steps:
37+
- name: Check out Code
38+
uses: actions/checkout@v3
39+
- name: Install Go
40+
uses: actions/setup-go@v3
41+
with:
42+
go-version-file: "go.mod"
43+
check-latest: true
44+
- name: Write Go List
45+
run: go list -json -deps ./... > go.list
46+
- name: Nancy
47+
uses: sonatype-nexus-community/nancy-github-action@main
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Publish Test Base Image
2+
on:
3+
push:
4+
tags:
5+
- 'v*'
6+
7+
jobs:
8+
publish_test_base_image:
9+
runs-on: ubuntu-latest
10+
environment: integration
11+
permissions:
12+
id-token: write
13+
contents: read
14+
env:
15+
BASE_IMAGE_TAG: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com/test-base-image:${{ github.ref_name }}
16+
steps:
17+
- uses: actions/checkout@v3
18+
- name: Build Base Image
19+
uses: goplugin/pluginv3.0-github-actions/docker/build-push@cb4a8f51d77cbf77ea6a765bd1f437ffc7a18730 # v2.0.28
20+
with:
21+
tags: ${{ env.BASE_IMAGE_TAG }}
22+
file: Dockerfile.base
23+
AWS_REGION: ${{ secrets.QA_AWS_REGION }}
24+
AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Static Analysis
2+
on:
3+
push:
4+
branches: ["master"]
5+
schedule:
6+
- cron: "23 19 * * 4"
7+
jobs:
8+
codeQL:
9+
name: CodeQL Checks
10+
runs-on: ubuntu-latest
11+
permissions:
12+
security-events: write
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v3
16+
- name: Initialize CodeQL
17+
uses: github/codeql-action/init@v2
18+
with:
19+
languages: go
20+
- name: Autobuild
21+
uses: github/codeql-action/autobuild@v2
22+
- name: Perform CodeQL Analysis
23+
uses: github/codeql-action/analyze@v2

.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
cmd/chaos
2+
bin/
3+
# temp manifest for deployment and validation
4+
tmp-manifest-*.yaml
5+
# remote runner binary
6+
remote.test
7+
e2e.test
8+
9+
.vscode/
10+
.idea/
11+
.direnv/
12+
13+
k3dvolume/

.golangci.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
run:
2+
timeout: 5m
3+
skip-dirs:
4+
- bin
5+
- imports
6+
issues:
7+
exclude-use-default: false
8+
linters-settings:
9+
revive:
10+
rules:
11+
- name: exported
12+
severity: warning
13+
- name: dot-imports
14+
disabled: true
15+
linters:

.goreleaser.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
project_name: plugin-env
2+
3+
release:
4+
github:
5+
owner: goplugin
6+
name: plugin-env
7+
8+
builds:
9+
- binary: plugin-env
10+
goos:
11+
- darwin
12+
- linux
13+
goarch:
14+
- amd64
15+
- arm64
16+
goarm:
17+
- 6
18+
- 7
19+
gomips:
20+
- hardfloat
21+
env:
22+
- CGO_ENABLED=0
23+
main: cmd/wizard/plugin-env.go
24+
flags:
25+
- -trimpath
26+
ldflags: -s -w -X main.version={{.Version}} -X main.commit={{.ShortCommit}} -X main.date={{.Date}}
27+
28+
archives:
29+
- format: tar.gz
30+
wrap_in_directory: true
31+
name_template: '{{ .ProjectName }}-{{ .Version }}-{{ .Os }}-{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
32+
files:
33+
- LICENSE
34+
- README.md
35+
36+
snapshot:
37+
name_template: SNAPSHOT-{{ .Commit }}
38+
39+
checksum:
40+
name_template: '{{ .ProjectName }}-{{ .Version }}-checksums.txt'
41+
42+
changelog:
43+
sort: asc
44+
filters:
45+
exclude:
46+
- '(?i)^docs?:'
47+
- '(?i)^docs\([^:]+\):'
48+
- '(?i)^docs\[[^:]+\]:'
49+
- '^tests?:'
50+
- '(?i)^dev:'
51+
- '^build\(deps\): bump .* in /docs \(#\d+\)'
52+
- Merge pull request
53+
- Merge branch

.tool-versions

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
golang 1.20.1
2+
helm 3.10.3
3+
golangci-lint 1.51.2
4+
kubectl 1.25.5
5+
nodejs 18.13.0
6+
yarn 1.22.19
7+
k3d 5.4.6

0 commit comments

Comments
 (0)