Compare commits

...

70 Commits
v1.0.1 ... main

Author SHA1 Message Date
semantic-release-bot
8f1654a3cf chore(release): 1.0.24 [skip ci]
## [1.0.24](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/compare/v1.0.23...v1.0.24) (2024-03-11)

### Bug Fixes

* Refactor to use filesystem storage instead of cookies ([aceb53e](aceb53efe9))
2024-03-11 04:23:07 +00:00
6851467d46 Merge branch 'main' of https://code.spamasaurus.com/djpbessems/ContainerImage.SpamasaurusRex
All checks were successful
Container & Helm chart / Semantic Release (Dry-run) (push) Successful in 33s
Container & Helm chart / Helm chart (push) Successful in 17s
Container & Helm chart / Container image (push) Successful in 1m46s
Container & Helm chart / Semantic Release (push) Successful in 34s
2024-03-11 15:20:09 +11:00
aceb53efe9 fix: Refactor to use filesystem storage instead of cookies 2024-03-11 15:20:08 +11:00
semantic-release-bot
0be0c38fb1 chore(release): 1.0.23 [skip ci]
## [1.0.23](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/compare/v1.0.22...v1.0.23) (2024-03-11)

### Bug Fixes

* Register type with gob interface ([cdbfe64](cdbfe64f5c))
2024-03-11 04:09:55 +00:00
d946069f6a Merge branch 'main' of https://code.spamasaurus.com/djpbessems/ContainerImage.SpamasaurusRex
All checks were successful
Container & Helm chart / Semantic Release (Dry-run) (push) Successful in 34s
Container & Helm chart / Helm chart (push) Successful in 21s
Container & Helm chart / Container image (push) Successful in 1m41s
Container & Helm chart / Semantic Release (push) Successful in 37s
2024-03-11 15:07:02 +11:00
cdbfe64f5c fix: Register type with gob interface 2024-03-11 15:07:00 +11:00
semantic-release-bot
6eb24cc601 chore(release): 1.0.22 [skip ci]
## [1.0.22](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/compare/v1.0.21...v1.0.22) (2024-03-11)

### Bug Fixes

* Add multiple verbose debugging ([d6148f2](d6148f289a))
2024-03-11 03:58:54 +00:00
2b61ef233d Merge branch 'main' of https://code.spamasaurus.com/djpbessems/ContainerImage.SpamasaurusRex
All checks were successful
Container & Helm chart / Semantic Release (Dry-run) (push) Successful in 32s
Container & Helm chart / Helm chart (push) Successful in 23s
Container & Helm chart / Container image (push) Successful in 1m51s
Container & Helm chart / Semantic Release (push) Successful in 35s
2024-03-11 14:55:51 +11:00
d6148f289a fix: Add multiple verbose debugging 2024-03-11 14:55:49 +11:00
semantic-release-bot
e1987287e3 chore(release): 1.0.21 [skip ci]
## [1.0.21](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/compare/v1.0.20...v1.0.21) (2024-03-11)

### Bug Fixes

* Add verbose debugging after session store ([1e0ddbc](1e0ddbc0ee))
2024-03-11 03:44:55 +00:00
98d2a6c3b2 Merge branch 'main' of https://code.spamasaurus.com/djpbessems/ContainerImage.SpamasaurusRex
All checks were successful
Container & Helm chart / Semantic Release (Dry-run) (push) Successful in 33s
Container & Helm chart / Helm chart (push) Successful in 24s
Container & Helm chart / Container image (push) Successful in 1m41s
Container & Helm chart / Semantic Release (push) Successful in 37s
2024-03-11 14:42:03 +11:00
1e0ddbc0ee fix: Add verbose debugging after session store 2024-03-11 14:42:01 +11:00
semantic-release-bot
22607d3601 chore(release): 1.0.20 [skip ci]
## [1.0.20](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/compare/v1.0.19...v1.0.20) (2024-03-11)

### Bug Fixes

* Add more debug logging ([63f764d](63f764d1c5))
2024-03-11 03:35:13 +00:00
a553e9e93a Merge branch 'main' of https://code.spamasaurus.com/djpbessems/ContainerImage.SpamasaurusRex
All checks were successful
Container & Helm chart / Semantic Release (Dry-run) (push) Successful in 33s
Container & Helm chart / Helm chart (push) Successful in 26s
Container & Helm chart / Container image (push) Successful in 1m42s
Container & Helm chart / Semantic Release (push) Successful in 36s
2024-03-11 14:32:18 +11:00
63f764d1c5 fix: Add more debug logging 2024-03-11 14:32:17 +11:00
semantic-release-bot
19ddd10164 chore(release): 1.0.19 [skip ci]
## [1.0.19](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/compare/v1.0.18...v1.0.19) (2024-03-11)

### Bug Fixes

* Add error handling to session store ([1af5051](1af505196a))
2024-03-11 03:24:51 +00:00
97aae89ce9 Merge branch 'main' of https://code.spamasaurus.com/djpbessems/ContainerImage.SpamasaurusRex
All checks were successful
Container & Helm chart / Semantic Release (Dry-run) (push) Successful in 32s
Container & Helm chart / Container image (push) Successful in 1m34s
Container & Helm chart / Helm chart (push) Successful in 41s
Container & Helm chart / Semantic Release (push) Successful in 1m37s
2024-03-10 22:48:36 +11:00
1af505196a fix: Add error handling to session store 2024-03-10 22:48:34 +11:00
semantic-release-bot
02b33167ef chore(release): 1.0.18 [skip ci]
## [1.0.18](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/compare/v1.0.17...v1.0.18) (2024-03-10)

### Bug Fixes

* Replace incorrect http status code ([62c2730](62c27305f9))
2024-03-10 11:30:26 +00:00
98ea369664 Merge branch 'main' of https://code.spamasaurus.com/djpbessems/ContainerImage.SpamasaurusRex
All checks were successful
Container & Helm chart / Semantic Release (Dry-run) (push) Successful in 31s
Container & Helm chart / Helm chart (push) Successful in 17s
Container & Helm chart / Container image (push) Successful in 1m43s
Container & Helm chart / Semantic Release (push) Successful in 33s
2024-03-10 22:27:37 +11:00
62c27305f9 fix: Replace incorrect http status code 2024-03-10 22:27:34 +11:00
semantic-release-bot
7864ed98e6 chore(release): 1.0.17 [skip ci]
## [1.0.17](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/compare/v1.0.16...v1.0.17) (2024-03-10)

### Bug Fixes

* Remove superfluous response write ([c293406](c29340669c))
2024-03-10 11:19:45 +00:00
57d7e0cc69 Merge branch 'main' of https://code.spamasaurus.com/djpbessems/ContainerImage.SpamasaurusRex
All checks were successful
Container & Helm chart / Semantic Release (Dry-run) (push) Successful in 31s
Container & Helm chart / Helm chart (push) Successful in 16s
Container & Helm chart / Container image (push) Successful in 1m41s
Container & Helm chart / Semantic Release (push) Successful in 34s
2024-03-10 22:16:56 +11:00
c29340669c fix: Remove superfluous response write 2024-03-10 22:16:52 +11:00
semantic-release-bot
ae06c8fd14 chore(release): 1.0.16 [skip ci]
## [1.0.16](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/compare/v1.0.15...v1.0.16) (2024-03-10)

### Bug Fixes

* Change oath scopes & direct debugging to console. ([1d026d3](1d026d3ec4))
2024-03-10 11:06:31 +00:00
407895337b Merge branch 'main' of https://code.spamasaurus.com/djpbessems/ContainerImage.SpamasaurusRex
All checks were successful
Container & Helm chart / Semantic Release (Dry-run) (push) Successful in 31s
Container & Helm chart / Helm chart (push) Successful in 18s
Container & Helm chart / Container image (push) Successful in 1m48s
Container & Helm chart / Semantic Release (push) Successful in 30s
2024-03-10 22:03:38 +11:00
1d026d3ec4 fix: Change oath scopes & direct debugging to console. 2024-03-10 22:03:36 +11:00
semantic-release-bot
f4161b47d7 chore(release): 1.0.15 [skip ci]
## [1.0.15](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/compare/v1.0.14...v1.0.15) (2024-03-10)

### Bug Fixes

* Check for existing session w/ token ([ef817dc](ef817dc650))
2024-03-10 06:37:07 +00:00
b7e8d6ad5a Merge branch 'main' of https://code.spamasaurus.com/djpbessems/ContainerImage.SpamasaurusRex
All checks were successful
Container & Helm chart / Semantic Release (Dry-run) (push) Successful in 33s
Container & Helm chart / Helm chart (push) Successful in 17s
Container & Helm chart / Container image (push) Successful in 1m34s
Container & Helm chart / Semantic Release (push) Successful in 34s
2024-03-10 17:34:22 +11:00
ef817dc650 fix: Check for existing session w/ token 2024-03-10 17:34:20 +11:00
semantic-release-bot
c33b246cf2 chore(release): 1.0.14 [skip ci]
## [1.0.14](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/compare/v1.0.13...v1.0.14) (2024-03-10)

### Bug Fixes

* Add more extensive oauth scope ([9a6e8e2](9a6e8e25f2))
2024-03-10 06:08:38 +00:00
6d5b17515a Merge branch 'main' of https://code.spamasaurus.com/djpbessems/ContainerImage.SpamasaurusRex
All checks were successful
Container & Helm chart / Semantic Release (Dry-run) (push) Successful in 32s
Container & Helm chart / Helm chart (push) Successful in 17s
Container & Helm chart / Container image (push) Successful in 1m41s
Container & Helm chart / Semantic Release (push) Successful in 33s
2024-03-10 17:05:49 +11:00
9a6e8e25f2 fix: Add more extensive oauth scope 2024-03-10 17:05:47 +11:00
semantic-release-bot
9126817665 chore(release): 1.0.13 [skip ci]
## [1.0.13](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/compare/v1.0.12...v1.0.13) (2024-03-10)

### Bug Fixes

* Replace clientSecret value ([446999a](446999ac69))
2024-03-10 05:49:55 +00:00
dccca37237 Merge branch 'main' of https://code.spamasaurus.com/djpbessems/ContainerImage.SpamasaurusRex
All checks were successful
Container & Helm chart / Semantic Release (Dry-run) (push) Successful in 34s
Container & Helm chart / Helm chart (push) Successful in 17s
Container & Helm chart / Container image (push) Successful in 1m43s
Container & Helm chart / Semantic Release (push) Successful in 32s
2024-03-10 16:47:01 +11:00
446999ac69 fix: Replace clientSecret value 2024-03-10 16:46:59 +11:00
semantic-release-bot
b1f6a4666c chore(release): 1.0.12 [skip ci]
## [1.0.12](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/compare/v1.0.11...v1.0.12) (2024-03-10)

### Bug Fixes

* Add callback debugging ([774e302](774e302ce7))
2024-03-10 05:40:08 +00:00
fdf1501152 Merge branch 'main' of https://code.spamasaurus.com/djpbessems/ContainerImage.SpamasaurusRex
All checks were successful
Container & Helm chart / Semantic Release (Dry-run) (push) Successful in 31s
Container & Helm chart / Helm chart (push) Successful in 16s
Container & Helm chart / Container image (push) Successful in 1m40s
Container & Helm chart / Semantic Release (push) Successful in 32s
2024-03-10 16:37:19 +11:00
774e302ce7 fix: Add callback debugging 2024-03-10 16:37:17 +11:00
semantic-release-bot
f5f3b38299 chore(release): 1.0.11 [skip ci]
## [1.0.11](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/compare/v1.0.10...v1.0.11) (2024-03-10)

### Bug Fixes

* Remove redundant slash character ([7b69a76](7b69a765e2))
2024-03-10 05:25:56 +00:00
09dabc1c18 Merge branch 'main' of https://code.spamasaurus.com/djpbessems/ContainerImage.SpamasaurusRex
All checks were successful
Container & Helm chart / Semantic Release (Dry-run) (push) Successful in 42s
Container & Helm chart / Helm chart (push) Successful in 23s
Container & Helm chart / Container image (push) Successful in 1m51s
Container & Helm chart / Semantic Release (push) Successful in 40s
2024-03-10 16:22:43 +11:00
7b69a765e2 fix: Remove redundant slash character 2024-03-10 16:22:41 +11:00
semantic-release-bot
cf149957cc chore(release): 1.0.10 [skip ci]
## [1.0.10](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/compare/v1.0.9...v1.0.10) (2024-03-10)

### Bug Fixes

* Refactor to use oauth2 package ([bb4bd51](bb4bd5111f))
2024-03-10 04:51:41 +00:00
d8fbb60e3b Merge branch 'main' of https://code.spamasaurus.com/djpbessems/ContainerImage.SpamasaurusRex
All checks were successful
Container & Helm chart / Semantic Release (Dry-run) (push) Successful in 32s
Container & Helm chart / Helm chart (push) Successful in 17s
Container & Helm chart / Container image (push) Successful in 1m47s
Container & Helm chart / Semantic Release (push) Successful in 31s
2024-03-10 15:48:47 +11:00
bb4bd5111f fix: Refactor to use oauth2 package 2024-03-10 15:48:44 +11:00
semantic-release-bot
d864e11320 chore(release): 1.0.9 [skip ci]
## [1.0.9](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/compare/v1.0.8...v1.0.9) (2024-03-09)

### Bug Fixes

* Refactor to different client method ([216c955](216c955e68))
2024-03-09 11:41:29 +00:00
907fc9249c chore: Revert action extra_args
All checks were successful
Container & Helm chart / Semantic Release (Dry-run) (push) Successful in 24s
Container & Helm chart / Helm chart (push) Successful in 22s
Container & Helm chart / Container image (push) Successful in 10m39s
Container & Helm chart / Semantic Release (push) Successful in 33s
2024-03-09 22:29:45 +11:00
4adb8cd382 Merge branch 'main' of https://code.spamasaurus.com/djpbessems/ContainerImage.SpamasaurusRex
Some checks failed
Container & Helm chart / Semantic Release (Dry-run) (push) Successful in 29s
Container & Helm chart / Container image (push) Failing after 6s
Container & Helm chart / Helm chart (push) Successful in 16s
Container & Helm chart / Semantic Release (push) Has been skipped
2024-03-09 22:25:37 +11:00
216c955e68 fix: Refactor to different client method 2024-03-09 22:25:35 +11:00
d38686dc01 chore: Switch to verbose output for go build 2024-03-09 22:25:20 +11:00
semantic-release-bot
f787b14939 chore(release): 1.0.8 [skip ci]
## [1.0.8](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/compare/v1.0.7...v1.0.8) (2024-03-09)

### Bug Fixes

* Replace bogus scope with correct value ([44bf4e4](44bf4e4888))
2024-03-09 11:08:48 +00:00
e232eb7d8d Merge branch 'main' of https://code.spamasaurus.com/djpbessems/ContainerImage.SpamasaurusRex
All checks were successful
Container & Helm chart / Semantic Release (Dry-run) (push) Successful in 29s
Container & Helm chart / Helm chart (push) Successful in 16s
Container & Helm chart / Container image (push) Successful in 8m46s
Container & Helm chart / Semantic Release (push) Successful in 34s
2024-03-09 21:58:57 +11:00
44bf4e4888 fix: Replace bogus scope with correct value 2024-03-09 21:58:56 +11:00
semantic-release-bot
a7dedbe6db chore(release): 1.0.7 [skip ci]
## [1.0.7](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/compare/v1.0.6...v1.0.7) (2024-03-09)

### Bug Fixes

* Expand scope of debugging variable ([3dbfb4a](3dbfb4a917))
2024-03-09 07:20:14 +00:00
f02370d5bc Merge branch 'main' of https://code.spamasaurus.com/djpbessems/ContainerImage.SpamasaurusRex
All checks were successful
Container & Helm chart / Semantic Release (Dry-run) (push) Successful in 24s
Container & Helm chart / Helm chart (push) Successful in 15s
Container & Helm chart / Container image (push) Successful in 9m44s
Container & Helm chart / Semantic Release (push) Successful in 32s
2024-03-09 18:09:28 +11:00
3dbfb4a917 fix: Expand scope of debugging variable 2024-03-09 18:09:26 +11:00
semantic-release-bot
ddb220a889 chore(release): 1.0.6 [skip ci]
## [1.0.6](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/compare/v1.0.5...v1.0.6) (2024-03-09)

### Bug Fixes

* Add verbose debugging output ([b4d866b](b4d866bbe8))
2024-03-09 07:07:01 +00:00
ddbc209324 Merge branch 'main' of https://code.spamasaurus.com/djpbessems/ContainerImage.SpamasaurusRex
All checks were successful
Container & Helm chart / Semantic Release (Dry-run) (push) Successful in 32s
Container & Helm chart / Helm chart (push) Successful in 16s
Container & Helm chart / Container image (push) Successful in 9m3s
Container & Helm chart / Semantic Release (push) Successful in 33s
2024-03-09 17:56:49 +11:00
b4d866bbe8 fix: Add verbose debugging output 2024-03-09 17:56:47 +11:00
semantic-release-bot
4f14b47137 chore(release): 1.0.5 [skip ci]
## [1.0.5](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/compare/v1.0.4...v1.0.5) (2024-03-08)

### Bug Fixes

* Rebase to MSAL library for authentication ([3a0c288](3a0c288e55))
2024-03-08 08:29:55 +00:00
905f2aed8e Merge branch 'main' of https://code.spamasaurus.com/djpbessems/ContainerImage.SpamasaurusRex
All checks were successful
Container & Helm chart / Semantic Release (Dry-run) (push) Successful in 27s
Container & Helm chart / Helm chart (push) Successful in 15s
Container & Helm chart / Container image (push) Successful in 4m36s
Container & Helm chart / Semantic Release (push) Successful in 29s
2024-03-08 19:24:21 +11:00
3a0c288e55 fix: Rebase to MSAL library for authentication 2024-03-08 19:24:19 +11:00
semantic-release-bot
d650c1437c chore(release): 1.0.4 [skip ci]
## [1.0.4](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/compare/v1.0.3...v1.0.4) (2024-03-08)

### Bug Fixes

* Include Mozilla CA certificate list for TLS trust ([72ed807](72ed8073bf))
2024-03-08 01:37:44 +00:00
87b97ea82e Merge branch 'main' of https://code.spamasaurus.com/djpbessems/ContainerImage.SpamasaurusRex
All checks were successful
Container & Helm chart / Semantic Release (Dry-run) (push) Successful in 26s
Container & Helm chart / Helm chart (push) Successful in 15s
Container & Helm chart / Container image (push) Successful in 5m24s
Container & Helm chart / Semantic Release (push) Successful in 28s
2024-03-08 12:31:19 +11:00
72ed8073bf fix: Include Mozilla CA certificate list for TLS trust 2024-03-08 12:31:17 +11:00
semantic-release-bot
4058432f17 chore(release): 1.0.3 [skip ci]
## [1.0.3](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/compare/v1.0.2...v1.0.3) (2024-03-08)

### Bug Fixes

* Refactor to use interactivebrowser login ([580f64b](580f64b7f2))
2024-03-08 00:58:33 +00:00
8b4a635d15 Merge branch 'main' of https://code.spamasaurus.com/djpbessems/ContainerImage.SpamasaurusRex
All checks were successful
Container & Helm chart / Semantic Release (Dry-run) (push) Successful in 1m29s
Container & Helm chart / Helm chart (push) Successful in 36s
Container & Helm chart / Container image (push) Successful in 6m31s
Container & Helm chart / Semantic Release (push) Successful in 27s
2024-03-08 11:50:03 +11:00
580f64b7f2 fix: Refactor to use interactivebrowser login 2024-03-08 11:50:00 +11:00
semantic-release-bot
fe2f0b7816 chore(release): 1.0.2 [skip ci]
## [1.0.2](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/compare/v1.0.1...v1.0.2) (2024-03-01)

### Bug Fixes

* Add basic graph functionality ([4f441fa](4f441fa6b4))
2024-03-01 07:01:39 +00:00
4f441fa6b4 fix: Add basic graph functionality
All checks were successful
Container & Helm chart / Semantic Release (Dry-run) (push) Successful in 37s
Container & Helm chart / Helm chart (push) Successful in 28s
Container & Helm chart / Container image (push) Successful in 45m9s
Container & Helm chart / Semantic Release (push) Successful in 35s
2024-03-01 17:15:06 +11:00
9 changed files with 488 additions and 174 deletions

View File

@ -1,156 +0,0 @@
kind: pipeline
type: kubernetes
name: Container & Helm chart
trigger:
event:
exclude:
- tag
steps:
- name: Semantic Release (Dry-run)
image: library/node:20-slim
pull: always
commands:
- |
apt-get update
- |
apt-get install -y --no-install-recommends \
git-core \
ca-certificates
- |
npm install \
semantic-release \
@semantic-release/commit-analyzer \
@semantic-release/exec \
- |
export GIT_CREDENTIALS=$${GIT_USERNAME}:$${GIT_APIKEY}
- |
npx semantic-release \
--package @semantic-release/exec \
--package semantic-release \
--branches ${DRONE_BRANCH} \
--tag-format "v\$${version}" \
--dry-run \
--plugins @semantic-release/commit-analyzer,@semantic-release/exec \
--analyzeCommits @semantic-release/commit-analyzer \
--verifyRelease @semantic-release/exec \
--verifyReleaseCmd 'echo "$${nextRelease.version}" > .version'
environment:
GIT_APIKEY:
from_secret: git_apikey
GIT_USERNAME: djpbessems
# - name: Container image (Harbor)
# depends_on:
# - Semantic Release (Dry-run)
# image: gcr.io/kaniko-project/executor:debug
# pull: always
# commands:
# - |
# export VALID_TAG=$(cat .version 2> /dev/null) && [ -n "$VALID_TAG" ] || (echo 'No release tag - exiting'; exit 0)
# - |
# wget https://github.com/jqlang/jq/releases/download/jq-1.6/jq-linux64 -qO /bin/jq
# chmod +x /bin/jq
# - |
# /bin/jq '.auths["https://bv11-cr01.bessems.eu/v2/"].auth="'"$(echo -n $HARBOR_USERNAME':'$HARBOR_PASSWORD | base64)"'"' --null-input > /kaniko/.docker/config.json
# - |
# /kaniko/executor \
# --dockerfile=Dockerfile \
# --context=dir://. \
# --destination=bv11-cr01.bessems.eu/library/json-server:latest \
# --destination=bv11-cr01.bessems.eu/library/json-server:$VALID_TAG
# environment:
# HARBOR_USERNAME:
# from_secret: harbor_username
# HARBOR_PASSWORD:
# from_secret: harbor_password
- name: Container image (docker.io)
depends_on:
- Semantic Release (Dry-run)
image: gcr.io/kaniko-project/executor:debug
pull: always
commands:
- |
export VALID_TAG=$(cat .version 2> /dev/null) && [ -n "$VALID_TAG" ] || (echo 'No release tag - exiting'; exit 0)
- |
wget https://github.com/jqlang/jq/releases/download/jq-1.6/jq-linux64 -qO /bin/jq
chmod +x /bin/jq
- |
/bin/jq '.auths["https://index.docker.io/v1/"].auth="'"$(echo -n $DOCKER_USERNAME':'$DOCKER_PASSWORD | base64)"'"' --null-input > /kaniko/.docker/config.json
- |
/kaniko/executor \
--dockerfile=Dockerfile \
--context=dir://. \
--destination=docker.io/djpbessems/spamasaurusrex:latest \
--destination=docker.io/djpbessems/spamasaurusrex:$VALID_TAG
environment:
DOCKER_USERNAME:
from_secret: docker_username
DOCKER_PASSWORD:
from_secret: docker_password
# - name: Helm chart (Gitea)
# depends_on:
# - Semantic Release (Dry-run)
# image: bv11-cr01.bessems.eu/proxy/alpine/helm
# pull: always
# commands:
# - |
# export VALID_TAG=$(cat .version 2> /dev/null) && [ -n "$VALID_TAG" ] || (echo 'No release tag - exiting'; exit 0)
# sed -i 's/{{ chart_version }}/'$VALID_TAG'/g' charts/json-server/Chart.yaml
# sed -i 's/{{ image_tag }}/'$VALID_TAG'/g' charts/json-server/values.yaml
# - |
# helm package ./charts/json-server
# - |
# helm plugin install https://github.com/chartmuseum/helm-push
# - |
# helm repo add \
# --username $GIT_USERNAME \
# --password $GIT_APIKEY \
# spamasaurus \
# https://code.spamasaurus.com/api/packages/$GIT_USERNAME/helm
# - |
# helm cm-push \
# json-server-*.tgz \
# spamasaurus
# environment:
# GIT_APIKEY:
# from_secret: git_apikey
# GIT_USERNAME: djpbessems
- name: Semantic Release
depends_on:
# - Container image (Harbor)
- Container image (docker.io)
# - Helm chart (Gitea)
image: library/node:20-slim
pull: always
commands:
- |
export VALID_TAG=$(cat .version 2> /dev/null) && [ -n "$VALID_TAG" ] || (echo 'No release tag - exiting'; exit 0)
- |
apt-get update
- |
apt-get install -y --no-install-recommends \
git-core \
ca-certificates
- |
npm install \
semantic-release \
@semantic-release/changelog \
@semantic-release/commit-analyzer \
@semantic-release/git \
@semantic-release/release-notes-generator
- |
export GIT_CREDENTIALS=$${GIT_USERNAME}:$${GIT_APIKEY}
- |
npx semantic-release \
--branches ${DRONE_BRANCH} \
--tag-format "v\$${version}" \
--plugins @semantic-release/commit-analyzer,@semantic-release/release-notes-generator,@semantic-release/changelog,@semantic-release/git
environment:
GIT_APIKEY:
from_secret: git_apikey
GIT_USERNAME: djpbessems

View File

@ -54,6 +54,7 @@ jobs:
- name: Kaniko build
uses: aevea/action-kaniko@master
with:
# extra_args: -v debug
registry: code.spamasaurus.com
image: djpbessems/spamasaurusrex
username: ${{ secrets.GIT_USERNAME }}

View File

@ -1,3 +1,164 @@
## [1.0.24](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/compare/v1.0.23...v1.0.24) (2024-03-11)
### Bug Fixes
* Refactor to use filesystem storage instead of cookies ([aceb53e](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/commit/aceb53efe914ddc4ffd9c9ff3bad3917c138fd69))
## [1.0.23](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/compare/v1.0.22...v1.0.23) (2024-03-11)
### Bug Fixes
* Register type with gob interface ([cdbfe64](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/commit/cdbfe64f5c04ac7d19ae14ca9ff826d2990dc065))
## [1.0.22](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/compare/v1.0.21...v1.0.22) (2024-03-11)
### Bug Fixes
* Add multiple verbose debugging ([d6148f2](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/commit/d6148f289aa113f8325813e76bd039342987337a))
## [1.0.21](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/compare/v1.0.20...v1.0.21) (2024-03-11)
### Bug Fixes
* Add verbose debugging after session store ([1e0ddbc](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/commit/1e0ddbc0eea9f97839954ac6b24c99feb4be6447))
## [1.0.20](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/compare/v1.0.19...v1.0.20) (2024-03-11)
### Bug Fixes
* Add more debug logging ([63f764d](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/commit/63f764d1c56c5f66c15ef9cdf9139fabd4c3d8a4))
## [1.0.19](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/compare/v1.0.18...v1.0.19) (2024-03-11)
### Bug Fixes
* Add error handling to session store ([1af5051](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/commit/1af505196ad217b91169cdac771de2ec0a35482f))
## [1.0.18](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/compare/v1.0.17...v1.0.18) (2024-03-10)
### Bug Fixes
* Replace incorrect http status code ([62c2730](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/commit/62c27305f9ec1c922384ec8c44736414e79f8327))
## [1.0.17](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/compare/v1.0.16...v1.0.17) (2024-03-10)
### Bug Fixes
* Remove superfluous response write ([c293406](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/commit/c29340669ce60e19aca391ac19da3b9d275f1687))
## [1.0.16](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/compare/v1.0.15...v1.0.16) (2024-03-10)
### Bug Fixes
* Change oath scopes & direct debugging to console. ([1d026d3](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/commit/1d026d3ec450c94f3e0401d35f858db1627f6ef7))
## [1.0.15](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/compare/v1.0.14...v1.0.15) (2024-03-10)
### Bug Fixes
* Check for existing session w/ token ([ef817dc](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/commit/ef817dc650f36d170bc254158e4a9c789cee6693))
## [1.0.14](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/compare/v1.0.13...v1.0.14) (2024-03-10)
### Bug Fixes
* Add more extensive oauth scope ([9a6e8e2](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/commit/9a6e8e25f29d38dd3e66530d37445a5d5902db56))
## [1.0.13](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/compare/v1.0.12...v1.0.13) (2024-03-10)
### Bug Fixes
* Replace clientSecret value ([446999a](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/commit/446999ac69b38271c15a907beaad5f25b3363d5f))
## [1.0.12](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/compare/v1.0.11...v1.0.12) (2024-03-10)
### Bug Fixes
* Add callback debugging ([774e302](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/commit/774e302ce749f004e97650d05694162780e009d8))
## [1.0.11](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/compare/v1.0.10...v1.0.11) (2024-03-10)
### Bug Fixes
* Remove redundant slash character ([7b69a76](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/commit/7b69a765e2b8371a285999360721df81abee74c9))
## [1.0.10](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/compare/v1.0.9...v1.0.10) (2024-03-10)
### Bug Fixes
* Refactor to use oauth2 package ([bb4bd51](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/commit/bb4bd5111f4ca16fd43aeea3ae8c4ea0adda2090))
## [1.0.9](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/compare/v1.0.8...v1.0.9) (2024-03-09)
### Bug Fixes
* Refactor to different client method ([216c955](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/commit/216c955e68908d523a84cafd6cf182f9583e104e))
## [1.0.8](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/compare/v1.0.7...v1.0.8) (2024-03-09)
### Bug Fixes
* Replace bogus scope with correct value ([44bf4e4](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/commit/44bf4e4888738afebd28ad717153113753afd5f2))
## [1.0.7](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/compare/v1.0.6...v1.0.7) (2024-03-09)
### Bug Fixes
* Expand scope of debugging variable ([3dbfb4a](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/commit/3dbfb4a917fa5f886c52f0ae11c1cab73ecb7713))
## [1.0.6](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/compare/v1.0.5...v1.0.6) (2024-03-09)
### Bug Fixes
* Add verbose debugging output ([b4d866b](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/commit/b4d866bbe8cf3f9632fdf69de4f15779c0099a9f))
## [1.0.5](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/compare/v1.0.4...v1.0.5) (2024-03-08)
### Bug Fixes
* Rebase to MSAL library for authentication ([3a0c288](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/commit/3a0c288e55d4a717fa89f9548c5006e6c6bd7969))
## [1.0.4](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/compare/v1.0.3...v1.0.4) (2024-03-08)
### Bug Fixes
* Include Mozilla CA certificate list for TLS trust ([72ed807](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/commit/72ed8073bf65a04efc68a4de28f5319b3931f6bc))
## [1.0.3](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/compare/v1.0.2...v1.0.3) (2024-03-08)
### Bug Fixes
* Refactor to use interactivebrowser login ([580f64b](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/commit/580f64b7f203a2a55e0df1d34545e19fc070fecd))
## [1.0.2](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/compare/v1.0.1...v1.0.2) (2024-03-01)
### Bug Fixes
* Add basic graph functionality ([4f441fa](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/commit/4f441fa6b4c8d94703c4bd5364b39b2541b38ea8))
## [1.0.1](http://gitea.gitea.svc.cluster.local:3000/djpbessems/ContainerImage.SpamasaurusRex/compare/v1.0.0...v1.0.1) (2024-02-28)

View File

@ -14,6 +14,6 @@ WORKDIR /app
COPY --from=builder /app/main .
EXPOSE 80
EXPOSE 8080
CMD ["./main"]

6
chart-values.yml Normal file
View File

@ -0,0 +1,6 @@
ingress:
hosts:
- host: alias.spamasaurus.com
paths:
- path: /
pathType: ImplementationSpecific

49
go.mod
View File

@ -2,4 +2,51 @@ module pkg/spamasaurusrex
go 1.19
require github.com/gorilla/mux v1.8.1
require (
github.com/breml/rootcerts v0.2.16
github.com/gorilla/mux v1.8.1
github.com/gorilla/sessions v1.2.2
github.com/microsoftgraph/msgraph-sdk-go v1.34.0
golang.org/x/oauth2 v0.18.0
)
require (
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.1 // indirect
github.com/golang-jwt/jwt/v5 v5.2.0 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/gorilla/securecookie v1.1.2 // indirect
github.com/kylelemons/godebug v1.1.0 // indirect
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/sys v0.18.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.31.0 // indirect
)
require (
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.5.1
github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2 // indirect
github.com/cjlapao/common-go v0.0.39 // indirect
github.com/davecgh/go-spew v1.1.1
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/microsoft/kiota-abstractions-go v1.5.6 // indirect
github.com/microsoft/kiota-authentication-azure-go v1.0.2
github.com/microsoft/kiota-http-go v1.3.0 // indirect
github.com/microsoft/kiota-serialization-form-go v1.0.0 // indirect
github.com/microsoft/kiota-serialization-json-go v1.0.6 // indirect
github.com/microsoft/kiota-serialization-multipart-go v1.0.0 // indirect
github.com/microsoft/kiota-serialization-text-go v1.0.0 // indirect
github.com/microsoftgraph/msgraph-sdk-go-core v1.0.2 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/std-uritemplate/std-uritemplate/go v0.0.50 // indirect
github.com/stretchr/testify v1.8.4 // indirect
go.opentelemetry.io/otel v1.22.0 // indirect
go.opentelemetry.io/otel/metric v1.22.0 // indirect
go.opentelemetry.io/otel/trace v1.22.0 // indirect
golang.org/x/net v0.22.0 // indirect
golang.org/x/text v0.14.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

100
go.sum
View File

@ -1,2 +1,102 @@
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2 h1:c4k2FIYIh4xtwqrQwV0Ct1v5+ehlNXj5NI/MWVsiTkQ=
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2/go.mod h1:5FDJtLEO/GxwNgUxbwrY3LP0pEoThTQJtk2oysdXHxM=
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.5.1 h1:sO0/P7g68FrryJzljemN+6GTssUXdANk6aJ7T1ZxnsQ=
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.5.1/go.mod h1:h8hyGFDsU5HMivxiS2iYFZsgDbU9OnnJ163x5UGVKYo=
github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2 h1:LqbJ/WzJUwBf8UiaSzgX7aMclParm9/5Vgp+TY51uBQ=
github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2/go.mod h1:yInRyqWXAuaPrgI7p70+lDDgh3mlBohis29jGMISnmc=
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.1 h1:DzHpqpoJVaCgOUdVHxE8QB52S6NiVdDQvGlny1qvPqA=
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.1/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI=
github.com/breml/rootcerts v0.2.16 h1:yN1TGvicfHx8dKz3OQRIrx/5nE/iN3XT1ibqGbd6urc=
github.com/breml/rootcerts v0.2.16/go.mod h1:S/PKh+4d1HUn4HQovEB8hPJZO6pUZYrIhmXBhsegfXw=
github.com/cjlapao/common-go v0.0.39 h1:bAAUrj2B9v0kMzbAOhzjSmiyDy+rd56r2sy7oEiQLlA=
github.com/cjlapao/common-go v0.0.39/go.mod h1:M3dzazLjTjEtZJbbxoA5ZDiGCiHmpwqW9l4UWaddwOA=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dnaeon/go-vcr v1.2.0 h1:zHCHvJYTMh1N7xnV7zf1m1GPBF9Ad0Jk/whtQ1663qI=
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ=
github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
github.com/golang-jwt/jwt/v5 v5.2.0 h1:d/ix8ftRUorsN+5eMIlF4T6J8CAt9rch3My2winC1Jw=
github.com/golang-jwt/jwt/v5 v5.2.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY=
github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ=
github.com/gorilla/securecookie v1.1.2 h1:YCIWL56dvtr73r6715mJs5ZvhtnY73hBvEF8kXD8ePA=
github.com/gorilla/securecookie v1.1.2/go.mod h1:NfCASbcHqRSY+3a8tlWJwsQap2VX5pwzwo4h3eOamfo=
github.com/gorilla/sessions v1.2.2 h1:lqzMYz6bOfvn2WriPUjNByzeXIlVzURcPmgMczkmTjY=
github.com/gorilla/sessions v1.2.2/go.mod h1:ePLdVu+jbEgHH+KWw8I1z2wqd0BAdAQh/8LRvBeoNcQ=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
github.com/microsoft/kiota-abstractions-go v1.5.6 h1:3hd1sACWB2B9grv8KG1T8g/gGQ4A8kTLv91OUxHSxkE=
github.com/microsoft/kiota-abstractions-go v1.5.6/go.mod h1:2WX7Oh8V9SAdZ80OGeE53rcbdys54Pd38rAeDUghrpM=
github.com/microsoft/kiota-authentication-azure-go v1.0.2 h1:tClGeyFZJ+4Bakf8u0euPM4wqy4ethycdOgx3jyH3pI=
github.com/microsoft/kiota-authentication-azure-go v1.0.2/go.mod h1:aTcti0bUJEcq7kBfQG4Sr4ElvRNuaalXcFEu4iEyQ6M=
github.com/microsoft/kiota-http-go v1.3.0 h1:+DhZ6YGi9iDzPYK5v181H8qFthUm38tM6iuL/36EBpY=
github.com/microsoft/kiota-http-go v1.3.0/go.mod h1:K51qqc8bo6iNgJ0J2CGMk8HH//IPhrM/87Z0y2I/7I8=
github.com/microsoft/kiota-serialization-form-go v1.0.0 h1:UNdrkMnLFqUCccQZerKjblsyVgifS11b3WCx+eFEsAI=
github.com/microsoft/kiota-serialization-form-go v1.0.0/go.mod h1:h4mQOO6KVTNciMF6azi1J9QB19ujSw3ULKcSNyXXOMA=
github.com/microsoft/kiota-serialization-json-go v1.0.6 h1:8v8IXMGurLCRYZs1l0Ck75lN0wzKDLko69mNdQGVWeQ=
github.com/microsoft/kiota-serialization-json-go v1.0.6/go.mod h1:I0CiXKgvKDFOO35lQ5VpYmd2nFLXHdJUsHnG8z/TX7A=
github.com/microsoft/kiota-serialization-multipart-go v1.0.0 h1:3O5sb5Zj+moLBiJympbXNaeV07K0d46IfuEd5v9+pBs=
github.com/microsoft/kiota-serialization-multipart-go v1.0.0/go.mod h1:yauLeBTpANk4L03XD985akNysG24SnRJGaveZf+p4so=
github.com/microsoft/kiota-serialization-text-go v1.0.0 h1:XOaRhAXy+g8ZVpcq7x7a0jlETWnWrEum0RhmbYrTFnA=
github.com/microsoft/kiota-serialization-text-go v1.0.0/go.mod h1:sM1/C6ecnQ7IquQOGUrUldaO5wj+9+v7G2W3sQ3fy6M=
github.com/microsoftgraph/msgraph-sdk-go v1.34.0 h1:bYTX+95g9kw85FFipvD/wQSsF+9jitgfvAxAeMP6Rfs=
github.com/microsoftgraph/msgraph-sdk-go v1.34.0/go.mod h1:vrsU4lnP+OnIbVqPBv3wbRZpN8zhHOYWzoLf6led9ms=
github.com/microsoftgraph/msgraph-sdk-go-core v1.0.2 h1:GsZ2bUe+aMdPo9B6ivm0T9vlU9s4ufTScu+GqZnYNNw=
github.com/microsoftgraph/msgraph-sdk-go-core v1.0.2/go.mod h1:3c/v/N/iuH8UWDf4r4Z9FBiSyGeNZ54BHe2y+9Ccxtc=
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ=
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/std-uritemplate/std-uritemplate/go v0.0.50 h1:LAE6WYRmLlDXPtEzr152BnD/MHxGCKmcp5D2Pw0NvmU=
github.com/std-uritemplate/std-uritemplate/go v0.0.50/go.mod h1:CLZ1543WRCuUQQjK0BvPM4QrG2toY8xNZUm8Vbt7vTc=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
go.opentelemetry.io/otel v1.22.0 h1:xS7Ku+7yTFvDfDraDIJVpw7XPyuHlB9MCiqqX5mcJ6Y=
go.opentelemetry.io/otel v1.22.0/go.mod h1:eoV4iAi3Ea8LkAEI9+GFT44O6T/D0GWAVFyZVCC6pMI=
go.opentelemetry.io/otel/metric v1.22.0 h1:lypMQnGyJYeuYPhOM/bgjbFM6WE44W1/T45er4d8Hhg=
go.opentelemetry.io/otel/metric v1.22.0/go.mod h1:evJGjVpZv0mQ5QBRJoBF64yMuOf4xCWdXjK8pzFvliY=
go.opentelemetry.io/otel/trace v1.22.0 h1:Hg6pPujv0XG9QaVbGOBVHunyuLcCC3jN7WEhPx83XD0=
go.opentelemetry.io/otel/trace v1.22.0/go.mod h1:RbbHXVqKES9QhzZq/fE5UnOSILqRt40a21sPw2He1xo=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA=
golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc=
golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
golang.org/x/oauth2 v0.18.0 h1:09qnuIAgzdx1XplqJvW6CQqMCtGZykZWcXzPMPUusvI=
golang.org/x/oauth2 v0.18.0/go.mod h1:Wf7knwG0MPoWIMMBgFlEaSUDaKskp0dCfrlJRJXbBi8=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c=
google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

View File

@ -0,0 +1,93 @@
package graphhelper
import (
"context"
"strings"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
auth "github.com/microsoft/kiota-authentication-azure-go"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
"github.com/microsoftgraph/msgraph-sdk-go/models"
"github.com/microsoftgraph/msgraph-sdk-go/users"
)
type GraphHelper struct {
// deviceCodeCredential *azidentity.DeviceCodeCredential
InteractiveBrowserCredential *azidentity.InteractiveBrowserCredential
userClient *msgraphsdk.GraphServiceClient
graphUserScopes []string
}
func NewGraphHelper() *GraphHelper {
g := &GraphHelper{}
return g
}
func (g *GraphHelper) InitializeGraphForUserAuth() error {
// clientId := os.Getenv("CLIENT_ID")
clientId := "dccb4b93-3f75-4775-a94a-da39216d7daf"
// tenantId := os.Getenv("TENANT_ID")
tenantId := "ceeae22e-f163-4ac9-b7c2-45972d3aed4f"
// scopes := os.Getenv("GRAPH_USER_SCOPES")
scopes := "user.read"
g.graphUserScopes = strings.Split(scopes, ",")
// Create the device code credential
// credential, err := azidentity.NewDeviceCodeCredential(&azidentity.DeviceCodeCredentialOptions{
credential, err := azidentity.NewInteractiveBrowserCredential(&azidentity.InteractiveBrowserCredentialOptions{
ClientID: clientId,
TenantID: tenantId,
// UserPrompt: func(ctx context.Context, message azidentity.DeviceCodeMessage) error {
// fmt.Println(message.Message)
// return nil
// },
RedirectURL: "https://alias.spamasaurus.com/",
})
if err != nil {
return err
}
g.InteractiveBrowserCredential = credential
// Create an auth provider using the credential
authProvider, err := auth.NewAzureIdentityAuthenticationProviderWithScopes(credential, g.graphUserScopes)
if err != nil {
return err
}
// Create a request adapter using the auth provider
adapter, err := msgraphsdk.NewGraphRequestAdapter(authProvider)
if err != nil {
return err
}
// Create a Graph client using request adapter
client := msgraphsdk.NewGraphServiceClient(adapter)
g.userClient = client
return nil
}
func (g *GraphHelper) GetUserToken() (*string, error) {
token, err := g.InteractiveBrowserCredential.GetToken(context.Background(), policy.TokenRequestOptions{
Scopes: g.graphUserScopes,
})
if err != nil {
return nil, err
}
return &token.Token, nil
}
func (g *GraphHelper) GetUser() (models.Userable, error) {
query := users.UserItemRequestBuilderGetQueryParameters{
// Only request specific properties
Select: []string{"displayName", "mail", "userPrincipalName"},
}
return g.userClient.Me().Get(context.Background(),
&users.UserItemRequestBuilderGetRequestConfiguration{
QueryParameters: &query,
})
}

View File

@ -2,7 +2,7 @@ package main
import (
"context"
"fmt"
"encoding/gob"
"log"
"net/http"
"os"
@ -10,33 +10,37 @@ import (
"syscall"
"time"
_ "github.com/breml/rootcerts"
"github.com/davecgh/go-spew/spew"
"github.com/gorilla/mux"
"github.com/gorilla/sessions"
"golang.org/x/oauth2"
"golang.org/x/oauth2/microsoft"
)
func handler(w http.ResponseWriter, r *http.Request) {
query := r.URL.Query()
name := query.Get("name")
if name == "" {
name = "Guest"
}
log.Printf("Received request for %s\n", name)
w.Write([]byte(fmt.Sprintf("Hello, %s\n", name)))
var config = oauth2.Config{
ClientID: "dccb4b93-3f75-4775-a94a-da39216d7daf",
ClientSecret: "XN98Q~Wrp1RfakkihA1BaTKfokOSX9fuB01unanr",
Endpoint: microsoft.AzureADEndpoint("ceeae22e-f163-4ac9-b7c2-45972d3aed4f"),
RedirectURL: "https://alias.spamasaurus.com/callback",
Scopes: []string{"email", "openid", "profile", "user.read"},
}
func healthHandler(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
}
var sessionStore = sessions.NewFilesystemStore("", []byte("xDDBjhYwyndZty3exGNq2ahE8wHRCR4DfdCJCSoWXAYncfWw2UQDH63QcJ9CkrGx"))
func readinessHandler(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
func init() {
// Register the oauth2.Token type with gob
gob.Register(&oauth2.Token{})
}
func main() {
// Create Server and Route Handlers
r := mux.NewRouter()
r.HandleFunc("/", handler)
r.HandleFunc("/", rootHandler)
r.HandleFunc("/health", healthHandler)
r.HandleFunc("/callback", callbackHandler)
r.HandleFunc("/readiness", readinessHandler)
srv := &http.Server{
@ -58,6 +62,64 @@ func main() {
waitForShutdown(srv)
}
func rootHandler(w http.ResponseWriter, r *http.Request) {
session, err := sessionStore.Get(r, "spamasaurusRex")
if err != nil {
log.Println(spew.Sdump(err))
return
}
if token, ok := session.Values["token"]; ok {
log.Println(spew.Sdump(token))
w.Write([]byte("Token retrieved from session"))
} else {
log.Println(spew.Sdump(session))
url := config.AuthCodeURL("state", oauth2.AccessTypeOffline)
http.Redirect(w, r, url, http.StatusFound)
}
}
func callbackHandler(w http.ResponseWriter, r *http.Request) {
// Handle the callback after successful authentication
token, err := config.Exchange(r.Context(), r.URL.Query().Get("code"))
if err != nil {
if retrieveErr, ok := err.(*oauth2.RetrieveError); ok {
log.Println(retrieveErr.ErrorDescription + " (" + retrieveErr.ErrorCode + ")")
}
http.Error(w, "Error exchanging code for token", http.StatusInternalServerError)
return
}
// Store the token in the session
session, err := sessionStore.Get(r, "spamasaurusRex")
if err != nil {
log.Println(spew.Sdump(err))
return
}
session.Values["token"] = token
err = session.Save(r, w)
if err != nil {
log.Println(spew.Sdump(err))
return
}
log.Println(spew.Sdump(session))
// w.Write([]byte("Authentication successful!"))
url := "https://alias.spamasaurus.com"
http.Redirect(w, r, url, http.StatusSeeOther)
}
func healthHandler(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
}
func readinessHandler(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
}
func waitForShutdown(srv *http.Server) {
interruptChan := make(chan os.Signal, 1)
signal.Notify(interruptChan, os.Interrupt, syscall.SIGINT, syscall.SIGTERM)