Skip to content

Commit

Permalink
Validate Byte Order marks before committing to GitHub (#194)
Browse files Browse the repository at this point in the history
* yamlfmt

* add readme
  • Loading branch information
cyberbuff committed Apr 27, 2024
1 parent da0cc4e commit ba84224
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 14 deletions.
1 change: 0 additions & 1 deletion .github/workflows/check-installation.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
name: Check installation
on: pull_request

jobs:
install-invoke:
name: Install Invoke-Atomic
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
name: Lint
on: pull_request

jobs:
install-invoke:
name: Install Invoke-Atomic
Expand Down
8 changes: 2 additions & 6 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
name: publish-release
on:
push:
tags: [ 'v*.*.*' ]
tags: ['v*.*.*']
jobs:
publish-powershell-gallery:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2

- name: publishing
run: |
Install-Module -Name powershell-yaml -Force
Publish-Module -Path '.' -NuGetApiKey ${{ secrets.PGALLERY }}
shell: pwsh

build-docker-containers:
name: Build and Publish Containers
runs-on: ${{ matrix.os }}
Expand All @@ -41,13 +39,12 @@ jobs:
password: ${{ secrets.DOCKER_TOKEN }}
- name: Docker Build
run: |
docker build docker -f ${{ matrix.file }} -t ${{ matrix.tag }}
docker build docker -f ${{ matrix.file }} -t ${{ matrix.tag }}
docker build docker -f ${{ matrix.file }} -t ${{ matrix.latest }}
- name: Docker Push
run: |
docker push ${{ matrix.tag }}
docker push ${{ matrix.latest }}
publish-manfiest:
name: Publish Manifest
runs-on: ubuntu-latest
Expand Down Expand Up @@ -78,4 +75,3 @@ jobs:
run: |
docker manifest push redcanary/invoke-atomicredteam:${{ github.sha }}
docker manifest push redcanary/invoke-atomicredteam:latest
11 changes: 11 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: check-yaml
- id: fix-byte-order-marker
- repo: https://github.com/google/yamlfmt
rev: "v0.11.0"
hooks:
- id: yamlfmt
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,20 @@ Invoke-AtomicRedTeam is a PowerShell module to execute tests as defined in the [
See the Wiki for complete [Installation and Usage instructions](https://github.com/redcanaryco/invoke-atomicredteam/wiki).

Note: This execution frameworks works on Windows, MacOS and Linux. If using on MacOS or Linux you must install PowerShell Core first.

### Contributing
Ensure proper byte order marks (BOM) are maintained when utilizing a PowerShell linter with the following steps:

```shell
pip3 install pre-commit
pre-commit install
pre-commit install-hooks
```

By following these instructions, pre-commit hooks will be activated, automatically resolving any byte order mark issues within your PowerShell files. Additionally, these hooks will be triggered prior to committing code to your GitHub repository, ensuring consistent formatting and adherence to best practices.

You can also trigger pre-commit hooks manually by

```shell
pre-commit run --all-files
```
12 changes: 6 additions & 6 deletions kubernetes/k8s-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ spec:
app: atomicred
spec:
containers:
- name: atomicred
image: redcanary/invoke-atomicredteam
imagePullPolicy: "IfNotPresent"
command: ["sleep", "3560d"]
securityContext:
privileged: true
- name: atomicred
image: redcanary/invoke-atomicredteam
imagePullPolicy: "IfNotPresent"
command: ["sleep", "3560d"]
securityContext:
privileged: true
nodeSelector:
kubernetes.io/os: linux

0 comments on commit ba84224

Please sign in to comment.