Compare commits

...

8 Commits

Author SHA1 Message Date
Florian Brinker
4134449260 Update Drone config into seperate pipeline 2021-05-10 18:52:56 +02:00
Florian Brinker
1a2fcd577d Merge remote-tracking branch 'upstream/master' into feat-nightly 2021-05-10 18:48:55 +02:00
Florian Brinker
9e1b55b1f5 Fix typo 2021-05-10 18:43:10 +02:00
Florian Brinker
569622b11f prepare seperate development pipeline 2021-05-10 18:37:09 +02:00
Florian Brinker
5d14177f58 Change "target" label to "docker" 2021-05-10 18:23:41 +02:00
9aaa9acca9 Merge pull request 'fix: make build.sh not rely on tag being latest' (#6) from akloeckner/fbrinker-tileboard:feat-repos into master
Reviewed-on: fbrinker/docker-tileboard#6
2021-05-10 16:11:01 +00:00
f3e64254f5 Merge branch 'master' into feat-repos 2021-05-10 16:10:24 +00:00
dev-docker
6aec325301 fix: make build.sh not rely on tag being latest
This introduces:
* an explicit check for the existence of the latest version tag
  * This way, we don't need to bother to have `nightly` or `dev` tags in place. The new check works by `curl` failing, if the target tag does not exist.
* more verbose output
  * This was just for debugging actually, but I believe it might help in the future.
* input parameters to the `build.sh` script
  * This allows for using the script also from other repos. I'd like to keep trying things without having to ask you for checking in Drone.io...
2021-05-10 15:17:20 +00:00
3 changed files with 48 additions and 33 deletions

View File

@ -1,10 +1,35 @@
--- ---
kind: pipeline kind: pipeline
type: docker type: docker
name: default name: Production
steps: steps:
- name: Build Dockerfile
image: alpine
commands:
- apk update && apk add bash curl grep jq sed
- ./build.sh
- name: Build & Publish Image
image: plugins/docker
settings:
repo: fbrinker/tileboard
dockerfile: Dockerfile
username:
from_secret: docker_username
password:
from_secret: docker_password
trigger:
branch:
- master
---
kind: pipeline
type: docker
name: Development
steps:
- name: Check for changes in master branch - name: Check for changes in master branch
image: alpine image: alpine
commands: commands:
@ -35,21 +60,6 @@ steps:
password: password:
from_secret: docker_password from_secret: docker_password
- name: Prepare Release Dockerfile
image: alpine
commands:
- apk update && apk add bash curl grep jq sed
- ./build.sh
- name: Build & Publish Release Image
image: plugins/docker
settings:
repo: fbrinker/tileboard
username:
from_secret: docker_username
password:
from_secret: docker_password
trigger: trigger:
branch: branch:
- master - master

View File

@ -28,7 +28,7 @@ Besides the latest version, you can listen to updates for a specific version:
* fbrinker/tileboard:2.2.0 * fbrinker/tileboard:2.2.0
Additionally, there are `nightly` and `dev` builds as follows: Additionally, there are `nightly` and `dev` builds as follows:
* `fbrinker/tileboard:nightly` contains a nightly build of TileBoard's `master` branch. Use it to have the mode bleeding adge changes, which have not yet made it to a release version. * `fbrinker/tileboard:nightly` contains a nightly build of TileBoard's `master` branch. Use it to have the most bleeding edge changes, which have not made it into a release yet.
* `fbrinker/tileboard:dev` bundles TileBoard's source code and runs `yarn run dev` inside the container. Use it to modify the source, check your changes into GitHub and propose a pull request to TileBoard. See the TileBoard [contribution page](https://github.com/resoai/TileBoard/blob/master/CONTRIBUTING.md) for details. * `fbrinker/tileboard:dev` bundles TileBoard's source code and runs `yarn run dev` inside the container. Use it to modify the source, check your changes into GitHub and propose a pull request to TileBoard. See the TileBoard [contribution page](https://github.com/resoai/TileBoard/blob/master/CONTRIBUTING.md) for details.

View File

@ -1,36 +1,40 @@
#!/usr/bin/env bash #!/usr/bin/env bash
getVersionFromLatestRelease() { getVersionFromLatestRelease() {
version=`curl -s "https://api.github.com/repos/resoai/TileBoard/releases/latest" \ repo="${1-resoai/TileBoard}"
version=`curl -s "https://api.github.com/repos/$repo/releases/latest" \
| grep "tag_name" \ | grep "tag_name" \
| cut -d '"' -f 4 \ | cut -d '"' -f 4 \
| sed -e "s/v//"` | sed -e "s/v//"`
echo "$version" echo "$version"
} }
getDownloadUrl() { getDownloadUrl() {
url=`curl -s "https://api.github.com/repos/resoai/TileBoard/releases/latest" \ repo="${1-resoai/TileBoard}"
url=`curl -s "https://api.github.com/repos/$repo/releases/latest" \
| grep "browser_download_url" \ | grep "browser_download_url" \
| cut -d '"' -f 4` | cut -d '"' -f 4`
echo "$url" echo "$url"
} }
getLatestPublishedTag() { docker_tag_exists() {
latest_tag=`curl -s "https://hub.docker.com/v2/repositories/fbrinker/tileboard/tags?page_size=1" \ repo="${1-fbrinker/tileboard}"
| jq -r ".results[0].name"` tag="${2-latest}"
curl --silent -f -lSL "https://hub.docker.com/v2/repositories/$repo/tags/$tag" > /dev/null 2>&1
echo "$latest_tag"
} }
LATEST_RELEASE=`getVersionFromLatestRelease` source_repo="${1-resoai/TileBoard}"
LATEST_TAG=`getLatestPublishedTag` docker_repo="${2-fbrinker/tileboard}"
echo "Source repository: $source_repo."
echo "Docker repository: $docker_repo."
if [ "$LATEST_RELEASE" = "$LATEST_TAG" ]; then LATEST_RELEASE=`getVersionFromLatestRelease $source_repo`
echo "Nothing to do. Versions already match." echo "Latest release is: $LATEST_RELEASE."
echo "Release: $LATEST_RELEASE"
echo "Tag: $LATEST_TAG" if docker_tag_exists $docker_repo $LATEST_RELEASE; then
echo "Nothing to do. Latest release tag already exists."
exit 78 # drone.io exit code to stop but success the pipeline exit 78 # drone.io exit code to stop but success the pipeline
fi fi
@ -42,6 +46,7 @@ PATCH=$LATEST_RELEASE
echo "latest,$MAJOR,$MINOR,$PATCH" > .tags echo "latest,$MAJOR,$MINOR,$PATCH" > .tags
RELEASE_URL=`getDownloadUrl` RELEASE_URL=`getDownloadUrl`
echo "URL of release is: $RELEASE_URL."
echo "Writing $RELEASE_URL into Dockerfile..." echo "Writing release URL into Dockerfile..."
sed -i "s|%RELEASE_URL%|$RELEASE_URL|g" ./Dockerfile sed -i "s|%RELEASE_URL%|$RELEASE_URL|g" ./Dockerfile