-
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 #13 from nuvla/fix-12
* fix issue * test and build in CI * minor * typo * fix for aws/aws-sam-cli#3661 * exec permission for container-release.sh * multi-arch docker image build required
- Loading branch information
Showing
10 changed files
with
204 additions
and
19 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,9 @@ | ||
target | ||
.travis? | ||
pom.xml | ||
*.md | ||
.gitignore | ||
.idea | ||
code/tests | ||
code/requirements.tests.txt | ||
__pycache__ |
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 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,41 @@ | ||
# Automatic release for every new tag | ||
name: "Release" | ||
|
||
on: | ||
push: | ||
tags: | ||
- "*.*.*" | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-20.04 | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Multi-arch docker image build prerequired | ||
run: sudo docker run --privileged linuxkit/binfmt:v0.7 | ||
|
||
- name: Build and deploy on architecture | ||
env: | ||
DOCKER_USERNAME: ${{ secrets.SIXSQ_DOCKER_USERNAME }} | ||
DOCKER_PASSWORD: ${{ secrets.SIXSQ_DOCKER_PASSWORD }} | ||
DOCKER_ORG: nuvla | ||
run: ./container-release.sh | ||
|
||
|
||
notify: | ||
if: always() | ||
name: Post Workflow Status To Slack | ||
needs: | ||
- build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Slack Workflow Notification | ||
uses: Gamesight/slack-workflow-status@master | ||
with: | ||
# Required Input | ||
repo_token: ${{secrets.GITHUB_TOKEN}} | ||
slack_webhook_url: ${{secrets.SLACK_WEBHOOK_URL}} | ||
# Optional Input | ||
icon_emoji: ':rocket:' |
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,88 @@ | ||
#!/bin/bash -xe | ||
|
||
############################### | ||
# CHANGE THIS ON EVERY REPO # | ||
DOCKER_IMAGE=$(basename `git rev-parse --show-toplevel`) | ||
############################### | ||
|
||
# default env vars in GH actions | ||
GIT_BRANCH=$(echo ${GITHUB_REF} | awk -F'/' '{print $(NF)}' | sed -e 's/[^a-z0-9\._-]/-/g') | ||
|
||
# non-tagged builds are not releases, so they always go on nuvladev | ||
DOCKER_ORG=${DOCKER_ORG:-nuvladev} | ||
|
||
MANIFEST=${DOCKER_ORG}/${DOCKER_IMAGE}:${GIT_BRANCH} | ||
|
||
platforms=(amd64 arm64) | ||
|
||
|
||
# | ||
# remove any previous builds | ||
# | ||
|
||
rm -Rf target/*.tar | ||
mkdir -p target | ||
|
||
# | ||
# generate image for each platform | ||
# | ||
|
||
for platform in "${platforms[@]}"; do | ||
GIT_BUILD_TIME=$(date --utc +%FT%T.%3NZ) | ||
docker run --rm --privileged -v ${PWD}:/tmp/work --entrypoint buildctl-daemonless.sh moby/buildkit:master \ | ||
build \ | ||
--frontend dockerfile.v0 \ | ||
--opt platform=linux/${platform} \ | ||
--opt filename=./Dockerfile \ | ||
--opt build-arg:GIT_BRANCH=${GIT_BRANCH} \ | ||
--opt build-arg:GIT_BUILD_TIME=${GIT_BUILD_TIME} \ | ||
--opt build-arg:GIT_COMMIT_ID=${GITHUB_SHA} \ | ||
--opt build-arg:GITHUB_RUN_NUMBER=${GITHUB_RUN_NUMBER} \ | ||
--opt build-arg:GITHUB_RUN_ID=${GITHUB_RUN_ID} \ | ||
--opt build-arg:PROJECT_URL=${GIHUB_SERVER_URL}/${GITHUB_REPOSITORY} \ | ||
--output type=docker,name=${MANIFEST}-${platform},dest=/tmp/work/target/${DOCKER_IMAGE}-${platform}.docker.tar \ | ||
--local context=/tmp/work \ | ||
--local dockerfile=/tmp/work \ | ||
--progress plain | ||
|
||
done | ||
|
||
# | ||
# load all generated images | ||
# | ||
|
||
for platform in "${platforms[@]}"; do | ||
docker load --input ./target/${DOCKER_IMAGE}-${platform}.docker.tar | ||
done | ||
|
||
|
||
manifest_args=(${MANIFEST}) | ||
|
||
# | ||
# login to docker hub | ||
# | ||
|
||
unset HISTFILE | ||
echo ${DOCKER_PASSWORD} | docker login -u ${DOCKER_USERNAME} --password-stdin | ||
|
||
# | ||
# push all generated images | ||
# | ||
|
||
for platform in "${platforms[@]}"; do | ||
docker push ${MANIFEST}-${platform} | ||
manifest_args+=("${MANIFEST}-${platform}") | ||
done | ||
|
||
# | ||
# create manifest, update, and push | ||
# | ||
|
||
export DOCKER_CLI_EXPERIMENTAL=enabled | ||
docker manifest create "${manifest_args[@]}" | ||
|
||
for platform in "${platforms[@]}"; do | ||
docker manifest annotate ${MANIFEST} ${MANIFEST}-${platform} --arch ${platform} | ||
done | ||
|
||
docker manifest push --purge ${MANIFEST} |
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,2 @@ | ||
-r requirements.txt | ||
pytest==7.0.1 |
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 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 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 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 @@ | ||
../src/notify_deps.py |
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,14 @@ | ||
import unittest | ||
|
||
from notify_email import get_recipients | ||
|
||
|
||
class NotifyEmail(unittest.TestCase): | ||
|
||
def test_get_recipients(self): | ||
assert 0 == len(get_recipients({})) | ||
e1 = 'a@b.c' | ||
e2 = 'a@b.c' | ||
assert [e1] == get_recipients({'DESTINATION': e1}) | ||
assert [e1, e2] == get_recipients({'DESTINATION': f'{e1} {e2}'}) | ||
assert [e1, e2] == get_recipients({'DESTINATION': f' {e1} {e2} '}) |