Skip to content

Commit

Permalink
CI: turn off CircleCI; switch from merkely to kosli
Browse files Browse the repository at this point in the history
  • Loading branch information
JonJagger committed Aug 20, 2022
1 parent 1e8523c commit 2116333
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 48 deletions.
File renamed without changes.
38 changes: 21 additions & 17 deletions .circleci/merkely_log_deployment.sh
@@ -1,27 +1,27 @@
#!/bin/bash -Eeu

readonly MERKELY_CHANGE=merkely/change:latest
readonly MERKELY_OWNER=cyber-dojo
readonly MERKELY_PIPELINE=shas

# - - - - - - - - - - - - - - - - - - -
merkely_fingerprint()
{
echo "docker://${CYBER_DOJO_SHAS_IMAGE}:${CYBER_DOJO_SHAS_TAG}"
}

# - - - - - - - - - - - - - - - - - - -
merkely_log_deployment()
kosli_log_deployment()
{
local -r MERKELY_OWNER=cyber-dojo
local -r MERKELY_PIPELINE=shas
local -r MERKELY_ENVIRONMENT="${1}"
local -r MERKELY_HOST="${2}"

# Set CYBER_DOJO_SHAS_IMAGE, CYBER_DOJO_SHAS_TAG
local -r VERSIONER_URL=https://raw.githubusercontent.com/cyber-dojo/versioner/master
export $(curl "${VERSIONER_URL}/app/.env")
local -r CYBER_DOJO_SHAS_TAG="${CIRCLE_SHA1:0:7}"

# Pull image to ensure merkely_fingerprint() works
docker pull ${CYBER_DOJO_SHAS_IMAGE}:${CYBER_DOJO_SHAS_TAG}

docker run \
--env MERKELY_COMMAND=log_deployment \
--env MERKELY_OWNER=${MERKELY_OWNER} \
--env MERKELY_PIPELINE=${MERKELY_PIPELINE} \
--env MERKELY_FINGERPRINT=$(merkely_fingerprint) \
--env MERKELY_DESCRIPTION="Deployed to ${environment} in circleci pipeline" \
--env MERKELY_FINGERPRINT=$(kosli_fingerprint) \
--env MERKELY_DESCRIPTION="Deployed to ${MERKELY_ENVIRONMENT} in Github Actions pipeline" \
--env MERKELY_ENVIRONMENT="${MERKELY_ENVIRONMENT}" \
--env MERKELY_CI_BUILD_URL=${CIRCLE_BUILD_URL} \
--env MERKELY_HOST="${MERKELY_HOST}" \
Expand All @@ -32,7 +32,11 @@ merkely_log_deployment()
}

# - - - - - - - - - - - - - - - - - - -
merkely_fingerprint()
{
echo "docker://${CYBER_DOJO_SHAS_IMAGE}:${CYBER_DOJO_SHAS_TAG}"
}
VERSIONER_URL=https://raw.githubusercontent.com/cyber-dojo/versioner/master
export $(curl "${VERSIONER_URL}/app/.env")
export CYBER_DOJO_SHAS_TAG="${CIRCLE_SHA1:0:7}"
docker pull ${CYBER_DOJO_SHAS_IMAGE}:${CYBER_DOJO_SHAS_TAG}

readonly ENVIRONMENT="${1}"
readonly HOSTNAME="${2}"
kosli_log_deployment "${ENVIRONMENT}" "${HOSTNAME}"
2 changes: 2 additions & 0 deletions .github/workflows/force-ci-run
@@ -0,0 +1,2 @@
132
Edit this file for a quick way to force a CI run
12 changes: 5 additions & 7 deletions .github/workflows/main.yml
Expand Up @@ -38,7 +38,7 @@ jobs:
ecr_registry: 244531986313.dkr.ecr.eu-central-1.amazonaws.com
service_name: shas
gh_actions_iam_role_name: gh_actions_services

deploy-staging:
needs: [pre-build, build-test-push]
uses: cyber-dojo/reusable-actions-workflows/.github/workflows/deploy.yml@master
Expand All @@ -51,10 +51,9 @@ jobs:
gh_actions_iam_role_name: gh_actions_services
environment_url: https://beta.cyber-dojo.org
environment_name: staging
cyber_dojo_env_name: beta
cyber_dojo_env_name_aws: aws-beta
kosli_staging_host: https://staging.app.merkely.com
kosli_production_host: https://app.merkely.com
kosli_staging_host: https://staging.app.kosli.com
kosli_production_host: https://app.kosli.com
circle_sha1: ${{ github.sha }}
circle_build_url: ${{github.server_url}}/${{github.repository}}/actions/runs/${{github.run_id}}

Expand All @@ -70,9 +69,8 @@ jobs:
gh_actions_iam_role_name: gh_actions_services
environment_url: https://prod.cyber-dojo.org
environment_name: production
cyber_dojo_env_name: prod
cyber_dojo_env_name_aws: aws-prod
kosli_staging_host: https://staging.app.merkely.com
kosli_production_host: https://app.merkely.com
kosli_staging_host: https://staging.app.kosli.com
kosli_production_host: https://app.kosli.com
circle_sha1: ${{ github.sha }}
circle_build_url: ${{github.server_url}}/${{github.repository}}/actions/runs/${{github.run_id}}
2 changes: 1 addition & 1 deletion LICENSE.md
@@ -1,4 +1,4 @@
Copyright (c) 2021, [CyberDojo Foundation](http://blog.cyber-dojo.org/2015/08/cyber-dojo-foundation.html)
Copyright (c) 2022, [CyberDojo Foundation](http://blog.cyber-dojo.org/2015/08/cyber-dojo-foundation.html)
All rights reserved.


Expand Down
10 changes: 7 additions & 3 deletions README.md
@@ -1,6 +1,10 @@
# shas
![Github Action (main)](https://github.com/cyber-dojo/shas/actions/workflows/main.yml/badge.svg)

cyber-dojo's `/shas/index` page.
# cyber-dojo/shas

- The source for the [cyberdojo/shas](https://hub.docker.com/r/cyberdojo/shas/tags) Docker image.
- A docker-containerized stateless http micro-service for [https://cyber-dojo.org](http://cyber-dojo.org).
- Implements cyber-dojo's `/shas/index` page.

- - - -
![page snapshot](https://github.com/cyber-dojo/shas/blob/master/docs/snapshot.png)
![cyber-dojo.org home page](https://github.com/cyber-dojo/cyber-dojo/blob/master/shared/home_page_snapshot.png)
8 changes: 4 additions & 4 deletions build_test_publish.sh
Expand Up @@ -10,7 +10,7 @@ source "${SH_DIR}/echo_versioner_env_vars.sh"
source "${SH_DIR}/exit_zero_if_build_only.sh"
source "${SH_DIR}/exit_zero_if_show_help.sh"
source "${SH_DIR}/exit_non_zero_unless_installed.sh"
source "${SH_DIR}/merkely.sh"
source "${SH_DIR}/kosli.sh"
source "${SH_DIR}/on_ci_publish_tagged_images.sh"
source "${SH_DIR}/remove_old_images.sh"
source "${SH_DIR}/test_in_containers.sh"
Expand All @@ -20,7 +20,7 @@ export $(echo_versioner_env_vars)
exit_zero_if_show_help "$@"
exit_non_zero_unless_installed docker
exit_non_zero_unless_installed docker-compose
on_ci_merkely_declare_pipeline
on_ci_kosli_declare_pipeline
remove_old_images
build_tagged_images
exit_zero_if_build_only "$@"
Expand All @@ -29,5 +29,5 @@ client_up_healthy_and_clean "$@"
test_in_containers "$@"
containers_down
on_ci_publish_tagged_images
on_ci_merkely_log_artifact
on_ci_merkely_log_evidence
on_ci_kosli_log_artifact
on_ci_kosli_log_evidence
30 changes: 15 additions & 15 deletions sh/merkely.sh → sh/kosli.sh
Expand Up @@ -7,13 +7,13 @@ MERKELY_OWNER=cyber-dojo
MERKELY_PIPELINE=shas

# - - - - - - - - - - - - - - - - - - -
merkely_fingerprint()
kosli_fingerprint()
{
echo "docker://${CYBER_DOJO_SHAS_IMAGE}:${CYBER_DOJO_SHAS_TAG}"
}

# - - - - - - - - - - - - - - - - - - -
merkely_declare_pipeline()
kosli_declare_pipeline()
{
local -r hostname="${1}"

Expand All @@ -29,25 +29,25 @@ merkely_declare_pipeline()
}

# - - - - - - - - - - - - - - - - - - -
on_ci_merkely_declare_pipeline()
on_ci_kosli_declare_pipeline()
{
if ! on_ci ; then
return
fi

merkely_declare_pipeline https://staging.app.merkely.com
merkely_declare_pipeline https://app.merkely.com
kosli_declare_pipeline https://staging.app.kosli.com
kosli_declare_pipeline https://app.kosli.com
}

# - - - - - - - - - - - - - - - - - - -
merkely_log_artifact()
kosli_log_artifact()
{
local -r hostname="${1}"
docker run \
--env MERKELY_COMMAND=log_artifact \
--env MERKELY_OWNER=${MERKELY_OWNER} \
--env MERKELY_PIPELINE=${MERKELY_PIPELINE} \
--env MERKELY_FINGERPRINT=$(merkely_fingerprint) \
--env MERKELY_FINGERPRINT=$(kosli_fingerprint) \
--env MERKELY_IS_COMPLIANT=TRUE \
--env MERKELY_ARTIFACT_GIT_COMMIT=${CYBER_DOJO_SHAS_SHA} \
--env MERKELY_ARTIFACT_GIT_URL=https://github.com/${MERKELY_OWNER}/${MERKELY_PIPELINE}/commit/${CYBER_DOJO_SHAS_SHA} \
Expand All @@ -61,26 +61,26 @@ merkely_log_artifact()
}

# - - - - - - - - - - - - - - - - - - -
on_ci_merkely_log_artifact()
on_ci_kosli_log_artifact()
{
if ! on_ci ; then
return
fi

merkely_log_artifact https://staging.app.merkely.com
merkely_log_artifact https://app.merkely.com
kosli_log_artifact https://staging.app.kosli.com
kosli_log_artifact https://app.kosli.com
}

# - - - - - - - - - - - - - - - - - - -
merkely_log_evidence()
kosli_log_evidence()
{
local -r hostname="${1}"

docker run \
--env MERKELY_COMMAND=log_evidence \
--env MERKELY_OWNER=${MERKELY_OWNER} \
--env MERKELY_PIPELINE=${MERKELY_PIPELINE} \
--env MERKELY_FINGERPRINT=$(merkely_fingerprint) \
--env MERKELY_FINGERPRINT=$(kosli_fingerprint) \
--env MERKELY_EVIDENCE_TYPE=branch-coverage \
--env MERKELY_IS_COMPLIANT=TRUE \
--env MERKELY_DESCRIPTION="server & client line-coverage reports" \
Expand All @@ -95,15 +95,15 @@ merkely_log_evidence()
}

# - - - - - - - - - - - - - - - - - - -
on_ci_merkely_log_evidence()
on_ci_kosli_log_evidence()
{
if ! on_ci ; then
return
fi

write_evidence_json
merkely_log_evidence https://staging.app.merkely.com
merkely_log_evidence https://app.merkely.com
kosli_log_evidence https://staging.app.kosli.com
kosli_log_evidence https://app.kosli.com
}

# - - - - - - - - - - - - - - - - - - -
Expand Down
2 changes: 1 addition & 1 deletion sh/on_ci_publish_tagged_images.sh
Expand Up @@ -16,5 +16,5 @@ on_ci_publish_tagged_images()
# - - - - - - - - - - - - - - - - - - - - - - - -
on_ci()
{
[ -n "${CIRCLECI:-}" ]
[ -n "${CI:-}" ]
}

0 comments on commit 2116333

Please sign in to comment.