forked from avleen/bashttpd
-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
this commit introduces 1.0 of sampo.
There are considerable changes from what the MVP had (in order of impact/size of the change): - more of a plug-and-play experience for the end user. sampo now requires a folder somewhere that contains: `sampo.sh`, `sampo.conf` and `scripts/`. This drastically simplifies deployments in both containers and local instances and provides a nice workflow: - `mkdir -p sampo/scripts` - `cp yourscripts/*.sh sampo/scripts` - `cp sampo.sh sampo/` - `cp sampo.conf sampo/` - this allows nice portability and a faster deployment. The user dumps their scripts in `scripts/` then updates `sampo.conf` to set their endpoints and the scripts that they call. for containers, this can be done by adding them to the dockerfile, using a volume mount, or config maps in k8s. This should provide a lot of flexibility for someone with a lot of scripts to dump them in one spot, configure them, and test them - more versatile container deployement on both docker and kubernetes with better logging and parity with local deployment - `build.sh` now deploys local, docker, or k8s variants (`-l`, `-d`, `-k`) - `build.sh` now cleans up previous deployments `-c`, and runs tests `./build -i` - added debug logging - more comments in the code - enhanced some functions - better portability of some commands like stat since making this three years ago, I have seen the stars on the repo slowly increase. It is surpising to me, but nonetheless, it shows some interest, so I decided to push the mvp to a better state. If you are using sampo for something, I would like to hear from you on how you are using it and what you would like to see from it. thank you for using sampo. Signed-off-by: Jacob Salmela <[email protected]>
- Loading branch information
1 parent
ce4515b
commit cf89444
Showing
468 changed files
with
1,152 additions
and
709 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,75 +1,44 @@ | ||
name: Docker | ||
name: build and publish container image | ||
|
||
on: | ||
push: | ||
# Publish `master` as Docker `latest` image. | ||
branches: | ||
- master | ||
|
||
# Publish `v1.2.3` tags as releases. | ||
tags: | ||
- v* | ||
|
||
# Run tests for any PRs. | ||
pull_request: | ||
release: | ||
types: | ||
- published | ||
|
||
env: | ||
IMAGE_NAME: sampo | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: sampo/sampo | ||
|
||
jobs: | ||
# Run tests. | ||
# See also https://docs.docker.com/docker-hub/builds/automated-testing/ | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Run tests | ||
run: | | ||
if [ -f docker-compose.test.yml ]; then | ||
docker-compose --file docker-compose.test.yml build | ||
docker-compose --file docker-compose.test.yml run sut | ||
else | ||
docker build docker/sampo --file docker/sampo/Dockerfile | ||
fi | ||
# Push image to GitHub Packages. | ||
# See also https://docs.docker.com/docker-hub/builds/ | ||
push: | ||
# Ensure test job passes before pushing image. | ||
needs: test | ||
|
||
runs-on: ubuntu-latest | ||
if: github.event_name == 'push' | ||
permissions: | ||
packages: write | ||
contents: read | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Build image | ||
run: docker build docker/sampo --file docker/sampo/Dockerfile --tag $IMAGE_NAME | ||
run: docker build ./docker -f ./docker/Dockerfile --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}" | ||
|
||
- name: Log into GitHub Container Registry | ||
run: echo "${{ secrets.CR_PAT }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin | ||
- name: Log in to registry | ||
# This is where you will update the personal access token to GITHUB_TOKEN | ||
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin | ||
|
||
- name: Push image to GitHub Container Registry | ||
- name: Push image | ||
run: | | ||
IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/$IMAGE_NAME | ||
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME | ||
# Change all uppercase to lowercase | ||
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') | ||
# Strip git ref prefix from version | ||
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | ||
# Strip "v" prefix from tag name | ||
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') | ||
# Use Docker `latest` tag convention | ||
[ "$VERSION" == "master" ] && VERSION=latest | ||
echo IMAGE_ID=$IMAGE_ID | ||
echo VERSION=$VERSION | ||
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION | ||
docker push $IMAGE_ID:$VERSION |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
.DS_Store | ||
*.log | ||
.dockerignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
[submodule "bats-core"] | ||
path = test/bats-core | ||
path = test/test_helper/bats-core | ||
url = https://github.com/bats-core/bats-core.git | ||
[submodule "bats-file"] | ||
path = test/bats-file | ||
path = test/test_helper/bats-file | ||
url = https://github.com/bats-core/bats-file.git | ||
[submodule "bats-assert"] | ||
path = test/bats-assert | ||
path = test/test_helper/bats-assert | ||
url = https://github.com/bats-core/bats-assert.git | ||
[submodule "bats-support"] | ||
path = test/bats-support | ||
path = test/test_helper/bats-support | ||
url = https://github.com/bats-core/bats-support.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.