-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from ncsa/update-pg-docker
misc updates
- Loading branch information
Showing
11 changed files
with
255 additions
and
187 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 |
---|---|---|
@@ -0,0 +1,127 @@ | ||
name: Docker | ||
|
||
# This will run when: | ||
# - when new code is pushed to main to push the tags | ||
# latest as well as version tags | ||
# - when a pull request is created and updated to make sure the | ||
# Dockerfile is still valid. | ||
# To be able to push to dockerhub, this execpts the following | ||
# secrets to be set in the project: | ||
# - DOCKERHUB_USERNAME : username that can push to the org | ||
# - DOCKERHUB_PASSWORD : password asscoaited with the username | ||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
pull_request: | ||
|
||
jobs: | ||
docker: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
packages: write | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
# calculate some variables that are used later | ||
- name: variable setup | ||
run: | | ||
if [ "${{ github.event.release.target_commitish }}" != "" ]; then | ||
BRANCH="${{ github.event.release.target_commitish }}" | ||
elif [[ $GITHUB_REF =~ pull ]]; then | ||
BRANCH="$(echo $GITHUB_REF | sed 's#refs/pull/\([0-9]*\)/merge#PR-\1#')" | ||
else | ||
BRANCH=${GITHUB_REF##*/} | ||
fi | ||
push="false" | ||
if [ "$BRANCH" == "main" ]; then | ||
version="$(awk '/^## / { print tolower($2) }' CHANGELOG.md | head -1)" | ||
tags="latest" | ||
oldversion="" | ||
while [ "${oldversion}" != "${version}" ]; do | ||
oldversion="${version}" | ||
tags="${tags} ${version}" | ||
version=${version%.*} | ||
done | ||
version="$(awk '/^## / { print tolower($2) }' CHANGELOG.md | head -1)" | ||
push="true" | ||
elif [ "$BRANCH" == "develop" ]; then | ||
version="develop" | ||
tags="develop" | ||
else | ||
version="test" | ||
tags="${BRANCH}" | ||
fi | ||
push_tags="" | ||
for tag in ${tags}; do | ||
push_tags="${push_tags}ncsa/checks:${tag}," | ||
push_tags="${push_tags}ghcr.io/${{ github.repository_owner }}/checks:${tag}," | ||
done | ||
push_tags="${push_tags%,*}" | ||
echo "BRANCH=${BRANCH}" | ||
echo "VERSION=${version}" | ||
echo "TAGS=${tags}" | ||
echo "PUSH_TAGS=${push_tags}" | ||
echo "PUSH=${push}" >> $GITHUB_ENV | ||
echo "BRANCH=${BRANCH}" >> $GITHUB_ENV | ||
echo "VERSION=${version}" >> $GITHUB_ENV | ||
echo "TAGS=${push_tags}" >> $GITHUB_ENV | ||
# setup docker build | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
|
||
- name: Set up Docker Buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Inspect Builder | ||
run: | | ||
echo "Name: ${{ steps.buildx.outputs.name }}" | ||
echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}" | ||
echo "Status: ${{ steps.buildx.outputs.status }}" | ||
echo "Flags: ${{ steps.buildx.outputs.flags }}" | ||
echo "Platforms: ${{ steps.buildx.outputs.platforms }}" | ||
# login to registries | ||
- name: Login to DockerHub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# build the docker images | ||
- name: Build and push docker image | ||
uses: docker/build-push-action@v2 | ||
with: | ||
push: ${{ env.PUSH }} | ||
platforms: "linux/amd64,linux/arm64" | ||
cache-from: type=registry,ref=ncsa/checks-cache:${{ env.BRANCH }} | ||
cache-to: type=registry,ref=ncsa/checks-cache:${{ env.BRANCH }},mode=max | ||
tags: ${{ env.TAGS }} | ||
build-args: | | ||
VERSION=${{ env.VERSION }} | ||
GITSHA1=${{ github.sha }} | ||
# update README at DockerHub | ||
- name: Docker Hub Description | ||
if: github.event_name == 'push' && env.BRANCH == 'main' | ||
uses: peter-evans/dockerhub-description@v2 | ||
env: | ||
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | ||
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
DOCKERHUB_REPOSITORY: ncsa/checks | ||
README_FILEPATH: README.md |
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Create Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: get release info | ||
id: release_info | ||
run: | | ||
version="$(awk '/^## / { print tolower($2) }' CHANGELOG.md | head -1)" | ||
changelog="$(sed -e "1,/^## ${version}/d" -e "/^## /,\$d" CHANGELOG.md)" | ||
changelog="${changelog//'%'/'%25'}" | ||
changelog="${changelog//$'\n'/'%0A'}" | ||
changelog="${changelog//$'\r'/'%0D'}" | ||
echo "::set-output name=version::$version" | ||
echo "::set-output name=changelog::$changelog" | ||
- name: create release | ||
if: steps.release_info.outputs.version != 'unreleased' | ||
uses: actions/create-release@v1 | ||
id: create_release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ steps.release_info.outputs.version }} | ||
release_name: Release ${{ steps.release_info.outputs.version }} | ||
body: ${{ steps.release_info.outputs.changelog }} |
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Change Log | ||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](http://keepachangelog.com/) | ||
and this project adheres to [Semantic Versioning](http://semver.org/). | ||
|
||
## 1.0.1 - 2022-07-25 | ||
|
||
### Added | ||
- add support for standard postgresql environment variables [#2](https://github.com/ncsa/checks/issues/2) | ||
- GitHub action to create docker file [#3](https://github.com/ncsa/checks/issues/3) | ||
|
||
### Changed | ||
- more verbose logging in case of check_url, thanks @khk-globus | ||
- changed master branch to main branch. | ||
- changed PG_URI and PG_TABLE to be PGURI and PGTABLE to be consistent with other PG variables. | ||
- environment variable and argument in checks.json are flipped around to allow for deprecated environment variables. | ||
|
||
## 1.0.0 - 2020-08-07 | ||
|
||
### Added | ||
- support for RabbitMQ | ||
- support for MongoDB | ||
- support for URL | ||
- support for PostgreSQL |
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
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.