Skip to content

Commit d134a56

Browse files
authored
Merge pull request #77 from HilkopterBob/devel
2 parents bf21274 + d6a334d commit d134a56

26 files changed

+956
-475
lines changed
Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
name: golangci-lint
22
on:
3-
push:
4-
branches:
5-
- master
63
pull_request:
74
branches:
8-
- master
9-
- devel
5+
- '*'
106

117
permissions:
128
contents: read
13-
# Optional: allow read access to pull request. Use with `only-new-issues` option.
149
pull-requests: read
10+
checks: write
1511

1612
jobs:
1713
golangci:
@@ -25,4 +21,4 @@ jobs:
2521
- name: golangci-lint
2622
uses: golangci/golangci-lint-action@v6
2723
with:
28-
version: v1.59
24+
version: v1.60

.github/workflows/release-binary.yml

Lines changed: 0 additions & 21 deletions
This file was deleted.

.github/workflows/release_tag.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Automatic Release Workflow
2+
3+
on:
4+
push:
5+
tags:
6+
- '[0-9]+.[0-9]+.[0-9]+'
7+
workflow_dispatch:
8+
inputs:
9+
version:
10+
description: 'Version to release (e.g., 1.0.0)'
11+
required: true
12+
13+
jobs:
14+
release:
15+
name: Create Release
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: write
19+
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v3
23+
24+
25+
- name: Set APP_VERSION
26+
id: version
27+
run: |
28+
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
29+
VERSION=${{ github.event.inputs.version }}
30+
else
31+
VERSION=${{ github.ref }}
32+
VERSION=${VERSION#refs/tags/}
33+
fi
34+
echo "APP_VERSION=$VERSION" >> $GITHUB_ENV
35+
36+
- name: Build Go Application
37+
run: |
38+
mkdir -p ${{ github.workspace }}/packagelock
39+
APP_VERSION=${{ env.APP_VERSION }}
40+
CGO_ENABLED=0 GOOS=linux go build -ldflags "-X 'main.AppVersion=$APP_VERSION'" -o ${{ github.workspace }}/packagelock
41+
42+
- name: Create Release Archive
43+
run: |
44+
mkdir -p release
45+
cp -r ${{ github.workspace }}/packagelock ./release/packagelock
46+
tar -czvf release/packagelock-${{ env.APP_VERSION }}-linux-amd64.tar.gz -C release packagelock
47+
48+
- name: Calculate Checksum
49+
run: |
50+
md5sum ./release/packagelock-${{ env.APP_VERSION }}-linux-amd64.tar.gz | cut -f 1 -d " " > ./release/packagelock-${{ env.APP_VERSION }}-linux-amd64.tar.gz.md5
51+
- name: Get release URL
52+
id: get_release
53+
uses: bruceadams/get-release@v1.3.2
54+
env:
55+
GITHUB_TOKEN: ${{ github.token }}
56+
57+
- name: Upload Release Tarball
58+
id: upload-release-asset
59+
uses: actions/upload-release-asset@v1
60+
env:
61+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
62+
with:
63+
upload_url: ${{ steps.get_release.outputs.upload_url }}
64+
asset_path: ./release/packagelock-${{ env.APP_VERSION }}-linux-amd64.tar.gz
65+
asset_name: packagelock-${{ env.APP_VERSION }}-linux-amd64.tar.gz
66+
asset_content_type: application/gzip
67+
68+
- name: Upload Checksum
69+
id: upload-checksum-asset
70+
uses: actions/upload-release-asset@v1
71+
env:
72+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
73+
with:
74+
upload_url: ${{ steps.get_release.outputs.upload_url }}
75+
asset_path: ./release/packagelock-${{ env.APP_VERSION }}-linux-amd64.tar.gz.md5
76+
asset_name: packagelock-${{ env.APP_VERSION }}-linux-amd64.tar.gz.md5
77+
asset_content_type: text/plain

.github/workflows/test-build.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Upload Go test results
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- '*'
7+
8+
jobs:
9+
build:
10+
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
go-version: ['1.23.x']
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: Setup Go
19+
uses: actions/setup-go@v5
20+
with:
21+
go-version: ${{ matrix.go-version }}
22+
- name: Installing dependencies
23+
run: go get .
24+
- name: Building Package
25+
run: go build -tags *

.github/workflows/unit-tests.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Upload Go test results
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- '*'
7+
8+
jobs:
9+
build:
10+
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
go-version: ['1.23.x']
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: Setup Go
19+
uses: actions/setup-go@v5
20+
with:
21+
go-version: ${{ matrix.go-version }}
22+
- name: Installing dependencies
23+
run: go get .
24+
- name: Run Unit Tests
25+
run: go test -json > TestResults-${{ matrix.go-version }}.json
26+
- name: Uploading Testresults
27+
uses: actions/upload-artifact@v4
28+
with:
29+
name: Go-results-${{ matrix.go-version }}
30+
path: tests/results/TestResults-${{ matrix.go-version }}.json

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ certs/**
33
config.yaml
44
config.yml
55
packagelock.pid
6+
packagelock/**
7+
logs/**

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ RUN go mod download
1818
# Build
1919
ARG APP_VERSION="v0.1.0+hotfixes"
2020
RUN \
21-
CGO_ENABLED=0 GOOS=linux go build -ldflags "-X 'main.AppVersion=$APP_VERSION'" -o /packagelock
21+
CGO_ENABLED=0 GOOS=linux go build -ldflags "-X 'main.AppVersion=$APP_VERSION'" -o /app/packagelock
2222

2323
# Optional:
2424
# To bind to a TCP port, runtime parameters must be supplied to the docker command.
@@ -28,5 +28,5 @@ RUN \
2828
EXPOSE 8080
2929

3030
# Run
31-
CMD ["/packagelock", "start"]
31+
CMD ["/app/packagelock","start"]
3232

README.md

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/HilkopterBob/PackageLock/.github%2Fworkflows%2Frun-tests.yml)
2+
![GitHub Actions Workflow Status](https://github.com/hilkopterbob/packagelock/actions/workflows/test-build.yml/badge.svg)
3+
![GitHub Actions Workflow Status](https://github.com/hilkopterbob/packagelock/actions/workflows/golangci-lint.yml/badge.svg)
4+
![GitHub Actions Workflow Status](https://github.com/hilkopterbob/packagelock/actions/workflows/build-docker-container.yml/badge.svg)
5+
![GitHub Actions Workflow Status](https://github.com/hilkopterbob/packagelock/actions/workflows/unstable-build-docker-container.yml/badge.svg)
6+
27
![GitHub repo file or directory count](https://img.shields.io/github/directory-file-count/HilkopterBob/PackageLock)
38

49

@@ -110,11 +115,49 @@ Install docker. Thats it.
110115

111116
### Installation
112117

113-
Run the container:
118+
#### Docker Run:
114119
```bash
115120
sudo docker run -p 8080:8080 hilkopterbob/packagelock
116121
```
117122

123+
#### Docker Compose:
124+
125+
- download the docker-compose file:
126+
`~/ $: wget https://github.com/HilkopterBob/PackageLock/blob/master/docker-compose.yml`
127+
128+
- get the default config & rename it to `config.yml`:
129+
```bash
130+
~/ $: wget https://github.com/HilkopterBob/PackageLock/blob/master/default-config.yml
131+
~/ $: mv default-config.yml config.yml
132+
```
133+
- edit the config
134+
- run docker compose:
135+
`~/ $: docker-compose up -d`
136+
137+
The default-config:
138+
```yaml
139+
general:
140+
debug: true
141+
production: false
142+
database:
143+
address: 127.0.0.1
144+
port: 8000
145+
username: root
146+
password: root
147+
network:
148+
fqdn: 0.0.0.0
149+
port: 8080
150+
ssl: true
151+
ssl-config:
152+
allowselfsigned: true
153+
certificatepath: ./certs/testing.crt
154+
privatekeypath: ./certs/testing.key
155+
redirecthttp: true
156+
```
157+
158+
159+
160+
118161
<!-- USAGE EXAMPLES -->
119162
## Usage
120163
@@ -131,6 +174,8 @@ TODO: explain usage
131174
- [ ] backend-api to manage Agents & Hosts
132175
- [ ] frontend to visualize backend data
133176
- [ ] installable agent as background daemon
177+
- [ ] agent CLI:
178+
- [ ] `packagelock id` -> returns agent id
134179
- [ ] config management
135180
- [ ] TLS Encryption
136181
- [ ] Best Practice based Package Layout

0 commit comments

Comments
 (0)