Skip to content

stuttgart-things/dagger

Repository files navigation

stuttgart-things/dagger

collection of dagger modules.

MODULES

GOLANG

LINT PROJECT

dagger call -m \
"github.com/stuttgart-things/dagger/go@v0.2.2" \
lint --src "." --timeout 300s --progress plain

BUILD PROJECT

dagger call -m \
"github.com/stuttgart-things/dagger/go@v0.4.4" \
binary --src "." --os linux --arch amd64 --goMainFile main.go --binName calc \
export --path=/tmp/go/build/ --progress plain

RUN-WORKFLOW-CONTAINER-STAGE

dagger call -m \
github.com/stuttgart-things/dagger/go@v0.4.2 \
run-workflow-container-stage --src tests/calculator/ \
--token=env:GITHUB_TOKEN --token-name GITHUB_TOKEN \
--repo ghcr.io/stuttgart-things/dagger \
--ko-version 3979dd70544adde24d336d5b605f4cf6f0ea9479 \
--output /tmp/calc-image.report.json --progress plain
ANSIBLE

the idea of this module is to create versioned collection artifcat 'on the fly' - this module can work with a file structure like this:

CREATE A COLLECTION PACKAGE

dagger call --progress plain -m ansible run-collection-build-pipeline \
--src ansible/collections/baseos \
--progress plain \
export --path=/tmp/ansible/output/

BUILD A GITHUB RELEASE FROM FILES

dagger call --progress plain -m ansible github-release \
--token=env:GITHUB_TOKEN \
--group stuttgart-things \
--repo dagger  \
--files "tests/test-values.yaml,tests/registry/README.md" \
--notes "test" \
--tag 09.1.6 \
--title hello
HELM

RENDER A CHART w/ VALUES

# EXAMPLE MODULE
VERSION=v0.0.4
dagger call -m github.com/stuttgart-things/dagger/helm@${VERSION} template --chart ./Service --values this-env.yaml

DEV

ALL TASKS
task: Available tasks for this project:
* branch:                Create branch from main
* check:                 Run pre-commit hooks
* commit:                Commit + push code into branch
* create:                Create new dagger module
* pr:                    Create pull request into main
* release:               push new version
* switch-local:          Switch to local branch
* switch-remote:         Switch to remote branch
* tasks:                 Select a task to run
* test:                  Select test to run
* test-ansible:          Test ansible modules
* test-crossplane:       Test crossplame modules
* test-go:               Test go modules
* test-helm:             Test helm modules
SELECT TASK
task=$(yq e '.tasks | keys' Taskfile.yaml | sed 's/^- //' | gum choose) && task ${task}
CREATE NEW MODULE
# EXAMPLE MODULE
MODULE=crossplane task create

DAGGER

LIST FUNCTIONS
MODULE=golang #example
dagger functions -m ${MODULE}/
CREATE NEW FUNCTION
MODULE=example #example
dagger init --sdk=go --source=./${MODULE} --name=${MODULE}
INSTAL EXTERNAL DAGGER MODULE
dagger install github.com/purpleclay/daggerverse/golang@v0.5.0


https://github.com/disaster37/dagger-library-go@v0.0.24
CALL FUNCTION FROM LOCAL
MODULE=example #example
dagger functions -m ${MODULE}
MODULE=helm #example
dagger call -m ./${MODULE} \
lint --source tests/test-chart/ \
--progress plain
CALL FUNCTION FROM LOCAL
MODULE=golang #example
dagger call -m github.com/stuttgart-things/dagger/${MODULE} build --progress plain --src ./ export --path build

LICENSE

APACHE 2.0

Copyright 2023 patrick hermann.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software 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.

Author Information

Patrick Hermann, stuttgart-things 11/2024