-
-
Notifications
You must be signed in to change notification settings - Fork 11
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 #1 from docksal/develop
Release 1.1.0
- Loading branch information
Showing
6 changed files
with
145 additions
and
2 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,28 @@ | ||
sudo: required | ||
|
||
language: generic | ||
|
||
env: | ||
REPO: docksal/ssh-agent | ||
IMAGE_DNS: ${REPO}:dev | ||
DOCKSAL_VERSION: develop | ||
|
||
services: | ||
- docker | ||
|
||
install: | ||
# Install Docksal to have a matching versions of Docker on the build host | ||
- curl -fsSL https://get.docksal.io | DOCKSAL_VERSION=${DOCKSAL_VERSION} bash | ||
- fin version | ||
- fin sysinfo | ||
|
||
script: | ||
- make | ||
- make start | ||
- make test | ||
|
||
after_success: | ||
- make release | ||
|
||
after_failure: | ||
- make logs |
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,4 +1,4 @@ | ||
FROM alpine:3.4 | ||
FROM alpine:3.8 | ||
|
||
RUN apk add --no-cache \ | ||
bash \ | ||
|
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,54 @@ | ||
-include env_make | ||
|
||
VERSION ?= dev | ||
|
||
REPO = docksal/ssh-agent | ||
NAME = docksal-ssh-agent | ||
|
||
.EXPORT_ALL_VARIABLES: | ||
|
||
.PHONY: build exec test push shell run start stop logs debug clean release | ||
|
||
build: | ||
docker build -t ${REPO}:${VERSION} . | ||
|
||
test: | ||
IMAGE=${REPO}:${VERSION} bats tests/test.bats | ||
|
||
push: | ||
docker push ${REPO}:${VERSION} | ||
|
||
exec: | ||
@docker exec ${NAME} ${CMD} | ||
|
||
exec-it: | ||
@docker exec -it ${NAME} ${CMD} | ||
|
||
shell: | ||
@make exec-it -e CMD=sh | ||
|
||
run: clean | ||
docker run --rm -it ${REPO}:${VERSION} sh | ||
|
||
# This is the only place where fin is used/necessary | ||
start: | ||
IMAGE_SSH_AGENT=${REPO}:${VERSION} fin system reset ssh-agent | ||
|
||
stop: | ||
docker stop ${NAME} | ||
|
||
logs: | ||
docker logs ${NAME} | ||
|
||
logs-follow: | ||
docker logs -f ${NAME} | ||
|
||
debug: build start logs-follow | ||
|
||
release: | ||
@scripts/release.sh | ||
|
||
clean: | ||
docker rm -vf ${NAME} || true | ||
|
||
default: build |
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,16 @@ | ||
#!/usr/bin/env bash | ||
|
||
if [[ "${TRAVIS_PULL_REQUEST}" == "false" ]]; then | ||
# develop => edge | ||
[[ "${TRAVIS_BRANCH}" == "develop" ]] && TAG="edge" | ||
# master => latest | ||
[[ "${TRAVIS_BRANCH}" == "master" ]] && TAG="latest" | ||
# tags/v1.2.0 => 1.2 | ||
[[ "${TRAVIS_TAG}" != "" ]] && TAG="${TRAVIS_TAG:1:3}" | ||
|
||
if [[ "$TAG" != "" ]]; then | ||
docker login -u "${DOCKER_USER}" -p "${DOCKER_PASS}" | ||
docker tag ${IMAGE_DNS} ${REPO}:${TAG} | ||
docker push ${REPO}:${TAG} | ||
fi; | ||
fi; |
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,45 @@ | ||
#!/usr/bin/env bats | ||
|
||
# Debugging | ||
teardown() { | ||
echo | ||
echo "Output:" | ||
echo "================================================================" | ||
echo "${output}" | ||
echo "================================================================" | ||
} | ||
|
||
# To work on a specific test: | ||
# run `export SKIP=1` locally, then comment skip in the test you want to debug | ||
|
||
@test "ssh-agent container is up and using the \"${IMAGE}\" image" { | ||
[[ ${SKIP} == 1 ]] && skip | ||
|
||
run docker ps --filter "name=docksal-ssh-agent" --format "{{ .Image }}" | ||
[[ "$output" =~ "$IMAGE" ]] | ||
unset output | ||
} | ||
|
||
@test "fin ssh-key add" { | ||
[[ ${SKIP} == 1 ]] && skip | ||
|
||
# Generate a key | ||
ssh_key_name="ssh_agent_test_id_rsa" | ||
ssh_key_file="${HOME}/.ssh/${ssh_key_name}" | ||
rm -f ${ssh_key_file} | ||
ssh-keygen -t rsa -b 4096 -f ${ssh_key_file} -q -N "" | ||
|
||
# Add the key to the agent | ||
run fin ssh-add ${ssh_key_name} | ||
# Cleanup garbage \r from the output otherwise there won't be an exact match | ||
[[ "$(echo ${output} | tr -d '\r')" == "Identity added: ${ssh_key_name} (${ssh_key_name})" ]] | ||
unset output | ||
|
||
# Check they key is present in the agent | ||
run fin ssh-add -l | ||
[[ ${output} == *${ssh_key_name}* ]] | ||
unset output | ||
|
||
# Cleanup | ||
rm -f ${ssh_key_file} | ||
} |