Skip to content

Commit

Permalink
Add pre commit CI (#103)
Browse files Browse the repository at this point in the history
* Add pre-commit hooks configuration file

* Update pre-commit hooks in .pre-commit-config.yaml

* Remove unused hooks and skip hadolint in pre-commit.ci

* [pre-commit.ci] auto fixes from pre-commit.com hooks [CI SKIP]

for more information, see https://pre-commit.ci

* Update pre-commit hooks and add golangci-lint

* Add pre-commit.ci badge to README

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
Codycody31 and pre-commit-ci[bot] authored Feb 7, 2024
1 parent 2841939 commit 8cff995
Show file tree
Hide file tree
Showing 58 changed files with 171 additions and 133 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
],
"remoteUser": "root",
"postCreateCommand": "bash .devcontainer/postCreateCommand.sh"
}
}
2 changes: 1 addition & 1 deletion .devcontainer/postCreateCommand.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ npm install
cd ..


echo 'Container ready!'
echo 'Container ready!'
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ npm-debug.log
.coverage.*
.env
.aws
vendor
vendor
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
*.sh text eol=lf
*.txt text eol=lf
*.xml text eol=lf
*.vue text eol=lf
*.vue text eol=lf
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ updates:
commit-message:
prefix: fix
prefix-development: chore
include: scope
include: scope
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -141,4 +141,4 @@ dist
*.so
*.dylib
vendor/
__debug_bin
__debug_bin
35 changes: 35 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# cSpell:ignore checkmake hadolint autofix autoupdate
repos:
- repo: meta
hooks:
- id: check-hooks-apply
- id: check-useless-excludes
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/golangci/golangci-lint
rev: v1.55.2
hooks:
- id: golangci-lint
# FIXME: Executable `docker` not found
# - repo: https://git.schmidl.dev/schtobia/woodpecker-lint
# rev: 1.0.0
# hooks:
# - id: woodpecker-lint
- repo: https://github.com/mrtazz/checkmake
rev: 0.2.2
hooks:
- id: checkmake

ci:
autofix_commit_msg: |
[pre-commit.ci] auto fixes from pre-commit.com hooks [CI SKIP]
for more information, see https://pre-commit.ci
autofix_prs: true
autoupdate_branch: ""
autoupdate_commit_msg: "[pre-commit.ci] pre-commit autoupdate"
autoupdate_schedule: monthly
submodules: false
2 changes: 1 addition & 1 deletion .woodpecker/.web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ steps:
directory: web/
commands:
- npm run lint
when: *when
when: *when
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -200,4 +200,4 @@
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
limitations under the License.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# *
# * Portions of this file were derived from Woodpecker CI
# * https://github.com/woodpecker-ci/woodpecker/blob/main/Makefile
# *
# *
# * Woodpecker CI's licensed under the Apache License 2.0.
# * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
# *
Expand Down Expand Up @@ -188,4 +188,4 @@ bundle-agent: bundle-prepare ## Create bundles for agent
VERSION_NUMBER=$(VERSION_NUMBER) nfpm package --config ./nfpm/agent.yaml --target ./dist --packager rpm

.PHONY: bundle
bundle: bundle-agent ## Create all bundles
bundle: bundle-agent ## Create all bundles
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
<a href="https://opensource.org/licenses/Apache-2.0" title="License: Apache-2.0">
<img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg" alt="License: Apache-2.0">
</a>
<a href="https://results.pre-commit.ci/latest/github/VMGWARE/ContainerEchoes/master" title="pre-commit.ci results">
<img src="https://results.pre-commit.ci/badge/github/VMGWARE/ContainerEchoes/master.svg" alt="pre-commit.ci results">
</a>
</p>

## Description
Expand All @@ -24,7 +27,7 @@ ContainerEchoes is an open-source tool designed for efficient real-time Docker l
- **Web Interface and API**: Manage, query, and display logs through a user-friendly web interface and a robust API.
- **Flexible Log Retention**: Automatic log deletion after 48 hours, with options for longer retention.
- **Secure and Scalable**: Implements TLS/SSL for secure data transfer and is designed for scalability.

## Docker Image Support

ContainerEchoes provides Docker images for both its agent and server components, ensuring wide compatibility across different systems:
Expand Down
2 changes: 1 addition & 1 deletion agent/.env.example
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
ECHOES_SERVER=localhost:5000
ECHOES_AGENT_SECRET=
ECHOES_AGENT_SECRET=
2 changes: 1 addition & 1 deletion docker/.htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ RewriteRule ^api/(.*) http://localhost:5000/$1 [P,L]
# If the request is not for a real file or directory, serve index.html
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.html [L]
RewriteRule ^ index.html [L]
4 changes: 2 additions & 2 deletions docker/Dockerfile.agent
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# *
# * Portions of this file were derived from Woodpecker CI
# * https://github.com/woodpecker-ci/woodpecker
# *
# *
# * Woodpecker CI's licensed under the Apache License 2.0.
# * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
# *
Expand All @@ -31,4 +31,4 @@ EXPOSE 3000
COPY --from=build /src/dist/echoes-agent /bin/
COPY --from=build /etc/echoes/agent /etc

ENTRYPOINT ["/bin/echoes-agent"]
ENTRYPOINT ["/bin/echoes-agent"]
2 changes: 1 addition & 1 deletion docker/Dockerfile.server.arm64
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ RUN chmod +x /etc/services.d/apache/run /etc/services.d/nodejs/run
EXPOSE 80

# Use s6-overlay as the entrypoint
ENTRYPOINT ["/init"]
ENTRYPOINT ["/init"]
34 changes: 17 additions & 17 deletions docker/my-httpd.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
# This is the main Apache HTTP server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.4/> for detailed information.
# In particular, see
# In particular, see
# <URL:http://httpd.apache.org/docs/2.4/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
# consult the online docs. You have been warned.
# consult the online docs. You have been warned.
#
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path. If the filenames do *not* begin
# with "/", the value of ServerRoot is prepended -- so "logs/access_log"
# with ServerRoot set to "/usr/local/apache2" will be interpreted by the
# server as "/usr/local/apache2/logs/access_log", whereas "/logs/access_log"
# server as "/usr/local/apache2/logs/access_log", whereas "/logs/access_log"
# will be interpreted as '/logs/access_log'.

#
Expand Down Expand Up @@ -45,7 +45,7 @@ ServerRoot "/usr/local/apache2"
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Expand Down Expand Up @@ -201,7 +201,7 @@ LoadModule rewrite_module modules/mod_rewrite.so
<IfModule unixd_module>
#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
# httpd as root initially and it will switch.
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
Expand Down Expand Up @@ -242,7 +242,7 @@ ServerName 0.0.0.0:80

#
# Deny access to the entirety of your server's filesystem. You must
# explicitly permit access to web content directories in other
# explicitly permit access to web content directories in other
# <Directory> blocks below.
#
<Directory />
Expand Down Expand Up @@ -300,8 +300,8 @@ DocumentRoot "/usr/local/apache2/htdocs"
</IfModule>

#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
<Files ".ht*">
Require all denied
Expand Down Expand Up @@ -354,8 +354,8 @@ LogLevel warn

<IfModule alias_module>
#
# Redirect: Allows you to tell clients about documents that used to
# exist in your server's namespace, but do not anymore. The client
# Redirect: Allows you to tell clients about documents that used to
# exist in your server's namespace, but do not anymore. The client
# will make a new request for the document at its new location.
# Example:
# Redirect permanent /foo http://www.example.com/bar
Expand All @@ -372,7 +372,7 @@ LogLevel warn
# the filesystem path.

#
# ScriptAlias: This controls which directories contain server scripts.
# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the target directory are treated as applications and
# run by the server when requested rather than as documents sent to the
Expand Down Expand Up @@ -484,10 +484,10 @@ LogLevel warn
#MaxRanges unlimited

#
# EnableMMAP and EnableSendfile: On systems that support it,
# EnableMMAP and EnableSendfile: On systems that support it,
# memory-mapping or the sendfile syscall may be used to deliver
# files. This usually improves server performance, but must
# be turned off when serving from networked-mounted
# be turned off when serving from networked-mounted
# filesystems or if support for these functions is otherwise
# broken on your system.
# Defaults: EnableMMAP On, EnableSendfile Off
Expand All @@ -497,9 +497,9 @@ LogLevel warn

# Supplemental configuration
#
# The configuration files in the conf/extra/ directory can be
# included to add extra features or to modify the default configuration of
# the server, or you may simply copy their contents here and change as
# The configuration files in the conf/extra/ directory can be
# included to add extra features or to modify the default configuration of
# the server, or you may simply copy their contents here and change as
# necessary.

# Server-pool management (MPM specific)
Expand Down Expand Up @@ -547,4 +547,4 @@ Include conf/extra/proxy-html.conf
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
</IfModule>
2 changes: 1 addition & 1 deletion docs/docs/30-env-vars.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,4 @@ Remember to replace `localhost` with your actual database host.

## Next Steps

With your environment variables configured, you can proceed to [Configuring the Container Echoes Agent](agent-configuration).
With your environment variables configured, you can proceed to [Configuring the Container Echoes Agent](agent-configuration).
2 changes: 1 addition & 1 deletion nfpm/agent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# *
# * Portions of this file were derived from Woodpecker CI
# * https://github.com/woodpecker-ci/woodpecker
# *
# *
# * Woodpecker CI's licensed under the Apache License 2.0.
# * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
# *
Expand Down
2 changes: 1 addition & 1 deletion server/.dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
.env

# Ignore build output for vue
web/dist
web/dist
2 changes: 1 addition & 1 deletion server/.gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
*.sh text eol=lf
*.txt text eol=lf
*.xml text eol=lf
*.vue text eol=lf
*.vue text eol=lf
2 changes: 1 addition & 1 deletion server/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,4 @@ version

# Ignore IDE files
.idea
.vscode
.vscode
2 changes: 1 addition & 1 deletion shared/trsa/testData/data.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ Also, it is transporting information on plain http. that is an advantage for the

A great use case can specially found, as the keys can be perfectly used for authentication. If you can share keys face to face, there will be nothing to break into your communications. This technology, can be perfect, for plain message exchange like chat, or more integrated transactions, up to the use in distributed applications and blockchain.

The usage is documented in the modules README on npm. It is really easy, try it out.
The usage is documented in the modules README on npm. It is really easy, try it out.
2 changes: 1 addition & 1 deletion shared/trsa/testData/data.txt.signature
Original file line number Diff line number Diff line change
@@ -1 +1 @@
a152828c8864ac9cc59ddb34ad8f46a9134cb2b2fd3d53419a8be0db5fc410748e146192dc4fe3d6012dc3c36ab4ff669b123106d177e7444dede42cf3ce5d72bd464d78c4a9cf151fcc63431c3fcea08ac4424c97af7ad97e1ee01992685f972c724aa0e18af9cb57965d7b7fec95a782ebd4fa62a802082a5336d5e34d75302ffe85d74d57c5739f65760c4b2168b030ced77a856f9e34ffbc7d694a6dc0fbc739a9f7708e0c993a47cb97362672006e6758d904c4486026a0840d52bc17eeb9cb48edd77c8197df2225bb9e42a3ff39df21dfb6fed8ef9c171f9b0314e469344c235474aaa5685f39f72b579efae2efbb122c2495394444df7ad7f3fe1467
a152828c8864ac9cc59ddb34ad8f46a9134cb2b2fd3d53419a8be0db5fc410748e146192dc4fe3d6012dc3c36ab4ff669b123106d177e7444dede42cf3ce5d72bd464d78c4a9cf151fcc63431c3fcea08ac4424c97af7ad97e1ee01992685f972c724aa0e18af9cb57965d7b7fec95a782ebd4fa62a802082a5336d5e34d75302ffe85d74d57c5739f65760c4b2168b030ced77a856f9e34ffbc7d694a6dc0fbc739a9f7708e0c993a47cb97362672006e6758d904c4486026a0840d52bc17eeb9cb48edd77c8197df2225bb9e42a3ff39df21dfb6fed8ef9c171f9b0314e469344c235474aaa5685f39f72b579efae2efbb122c2495394444df7ad7f3fe1467
2 changes: 1 addition & 1 deletion shared/trsa/testData/privateKey
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ VtM/j6qz5L3YVvZ8L95W5tD3cWTYgtI3JlETGPkjchmPGushXzxIX7HpIgxoMY9K
yelLAQKBgQDEua1+xkuvUMZFlIvP+bsqFrxRrjfMUlXE3/EdwHCQWMh481ttmJqi
Ugs5rTJUBJK6aHeDB9Jush9FPW69/N3oECsSs9OQfs7p9EZGb5TXv72mRufpHOX+
ccmA1wkkQZXHydN3PE9IxZTPYt+pJlhikNbAgHMTIE57DQz0/ac+yw==
-----END RSA PRIVATE KEY-----
-----END RSA PRIVATE KEY-----
2 changes: 1 addition & 1 deletion shared/trsa/testData/publicKey
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ kJk1pMcVtnfZv+8z9qWyRVpzMccRPHrdnnIvkTYNKV9h4+e5F1161rgQnngyUBtH
GHuI+lBS0bARj+C4O3M+OWYQKyHQzknq7yBXKHLlKbl5sGFbw5FiwRqWYboLOwfu
q8QC6VmkXdLX6gKpKBWl4LzInW9V8fXPacvmZYZxGDmCWkkjUM0123CjwWggneTX
AwIDAQAB
-----END PUBLIC KEY-----
-----END PUBLIC KEY-----
24 changes: 12 additions & 12 deletions shared/trsa/trsa_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ func TestEncryptDecrypt(t *testing.T) {
if err != nil {
t.Fatal(err.Error())
}
data := []byte(`This weekend I made great progress for building secure independent apps.
With t-secure-express I provide a module, to have RSA encrypted communication between
a js web client and your express application. Both client and server are using my trsa
library, that is based on node-forge. So it is easy, for both sites to create their
crypto material. Also, the for the server side provided middleware can get applied to
any new or existing app. To enable secure RSA encrypted communication, without the need
data := []byte(`This weekend I made great progress for building secure independent apps.
With t-secure-express I provide a module, to have RSA encrypted communication between
a js web client and your express application. Both client and server are using my trsa
library, that is based on node-forge. So it is easy, for both sites to create their
crypto material. Also, the for the server side provided middleware can get applied to
any new or existing app. To enable secure RSA encrypted communication, without the need
for bothersome and for some part expensive and deployment delaying https certificates.
Using this tech, you can establish secure connections on your timeline. `)
encrypted, err := keypair.Encrypt(data)
Expand All @@ -75,12 +75,12 @@ func TestSignVerify(t *testing.T) {
if err != nil {
t.Fatal(err.Error())
}
data := []byte(`This weekend I made great progress for building secure independent apps.
With t-secure-express I provide a module, to have RSA encrypted communication between
a js web client and your express application. Both client and server are using my trsa
library, that is based on node-forge. So it is easy, for both sites to create their
crypto material. Also, the for the server side provided middleware can get applied to
any new or existing app. To enable secure RSA encrypted communication, without the need
data := []byte(`This weekend I made great progress for building secure independent apps.
With t-secure-express I provide a module, to have RSA encrypted communication between
a js web client and your express application. Both client and server are using my trsa
library, that is based on node-forge. So it is easy, for both sites to create their
crypto material. Also, the for the server side provided middleware can get applied to
any new or existing app. To enable secure RSA encrypted communication, without the need
for bothersome and for some part expensive and deployment delaying https certificates.
Using this tech, you can establish secure connections on your timeline. `)
signature, err := keypair.Sign(data)
Expand Down
2 changes: 1 addition & 1 deletion web/.prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
dist
node_modules
node_modules
2 changes: 1 addition & 1 deletion web/.prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
"vueIndentScriptAndStyle": false,
"endOfLine": "lf",
"singleAttributePerLine": true
}
}
2 changes: 1 addition & 1 deletion web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,4 @@
</script>
</body>

</html>
</html>
Loading

0 comments on commit 8cff995

Please sign in to comment.