Skip to content

Commit

Permalink
Add cache (#433)
Browse files Browse the repository at this point in the history
* Updated base image to the latest one

* Add cache

* cleanup resolvers

* remove jfrog

* remove snapshots repository

Co-authored-by: Ty <[email protected]>
Co-authored-by: Marios Tsekis <[email protected]>
  • Loading branch information
3 people authored Apr 20, 2021
1 parent d1058d6 commit e6a26ea
Show file tree
Hide file tree
Showing 8 changed files with 79 additions and 37 deletions.
1 change: 0 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
version: 2
updates:

- package-ecosystem: "github-actions"
directory: "/"
target-branch: "main"
Expand Down
28 changes: 14 additions & 14 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
name-template: 'v$RESOLVED_VERSION'
tag-template: 'v$RESOLVED_VERSION'
name-template: "v$RESOLVED_VERSION"
tag-template: "v$RESOLVED_VERSION"

categories:
- title: 'Features'
- title: "Features"
labels:
- 'feature'
- title: 'Bugs'
- "feature"
- title: "Bugs"
labels:
- 'bug'
- 'fix'
- title: 'Maintenance'
labels:
- 'chore'
- "bug"
- "fix"
- title: "Maintenance"
labels:
- "chore"

change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
change-template: "- $TITLE @$AUTHOR (#$NUMBER)"
change-title-escapes: '\<*_&'

version-resolver:
default: patch
major:
labels:
- 'major'
- "major"
minor:
labels:
- 'minor'
- "minor"
patch:
labels:
- 'patch'
- "patch"

template: |
## Changes
Expand Down
22 changes: 20 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,16 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: recursive

- name: Cache - GHA
uses: actions/cache@v1
with:
path: ~/.cache/coursier/v1/https
key: ${{ runner.OS }}-coursier-cache

- name: Add extra resolvers
run: curl https://${{ secrets.ARTIFACTS_CACHE_BUCKET }}/resolvers.sbt --create-dirs -o ~/.sbt/resolvers.sbt

- name: Setup
uses: actions/setup-java@v1
Expand Down Expand Up @@ -45,4 +54,13 @@ jobs:

- name: Build
run: sbt docker:stage && docker build hat/target/docker/stage


- name: AWS - Configure
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.DEPLOYER_SHARED_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.DEPLOYER_SHARED_SECRET_ACCESS_KEY }}
aws-region: eu-west-1

- name: Cache - Upload
run: aws s3 sync ~/.cache/coursier/v1/https/ s3://${{ secrets.ARTIFACTS_CACHE_BUCKET }} --sse AES256 --follow-symlinks --no-progress
16 changes: 13 additions & 3 deletions .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,19 @@ jobs:
with:
submodules: recursive

- name: Setup
uses: actions/setup-java@v1
- name: Cache - GHA
uses: actions/cache@v1
with:
path: ~/.cache/coursier/v1/https
key: ${{ runner.OS }}-coursier-cache

- name: Add extra resolvers
run: curl https://${{ secrets.ARTIFACTS_CACHE_BUCKET }}/resolvers.sbt --create-dirs -o ~/.sbt/resolvers.sbt

- name: Setup Java
uses: actions/setup-java@v2
with:
distribution: adopt
java-version: 11
java-package: jdk
architecture: x64
Expand Down Expand Up @@ -57,7 +67,7 @@ jobs:
with:
username: ${{ secrets.DOCKERHUB_DATASWIFT_USER }}
password: ${{ secrets.DOCKERHUB_DATASWIFT_PASS }}

- name: Container Registry - Push
run: docker push ${{ env.REPOSITORY }}:${{ github.sha }}

Expand Down
14 changes: 12 additions & 2 deletions .github/workflows/deploy-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,19 @@ jobs:
with:
submodules: recursive

- name: Setup
uses: actions/setup-java@v1
- name: Cache - GHA
uses: actions/cache@v1
with:
path: ~/.cache/coursier/v1/https
key: ${{ runner.OS }}-coursier-cache

- name: Add extra resolvers
run: curl https://${{ secrets.ARTIFACTS_CACHE_BUCKET }}/resolvers.sbt --create-dirs -o ~/.sbt/resolvers.sbt

- name: Setup Java
uses: actions/setup-java@v2
with:
distribution: adopt
java-version: 11
java-package: jdk
architecture: x64
Expand Down
14 changes: 12 additions & 2 deletions .github/workflows/deploy-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,19 @@ jobs:
with:
submodules: recursive

- name: Setup
uses: actions/setup-java@v1
- name: Cache - GHA
uses: actions/cache@v1
with:
path: ~/.cache/coursier/v1/https
key: ${{ runner.OS }}-coursier-cache

- name: Add extra resolvers
run: curl https://${{ secrets.ARTIFACTS_CACHE_BUCKET }}/resolvers.sbt --create-dirs -o ~/.sbt/resolvers.sbt

- name: Setup Java
uses: actions/setup-java@v2
with:
distribution: adopt
java-version: 11
java-package: jdk
architecture: x64
Expand Down
13 changes: 5 additions & 8 deletions .github/workflows/trivy.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
# Run trivy creating a github issue for any issues
# For each github issue create a Jira Ticket linking to the issue
name: Trivy Jira
name: Trivy

on:
workflow_dispatch:
schedule:
- cron: '0 4 * * MON'
- cron: "0 4 * * MON"

env:
REGISTRY: dataswift/hat
Expand All @@ -31,9 +29,9 @@ env:
with:
token: ${{ secrets.GITHUB_TOKEN }}
image: ${{ env.REGISTRY }}:${{ github.sha }}
issue: 'true'
issue: "true"
issue_label: trivy, vulnerability, security
issue_title: Trivy generated Security Alert
issue_title: Trivy Security Alert

- name: Jira Login
if: steps.trivy.outputs.issue_number != ''
Expand All @@ -50,7 +48,7 @@ env:
with:
project: ${{ secrets.JIRA_TRIVY_PROJECT }}
issuetype: ${{ secrets.JIRA_TRIVY_ISSUE_TYPE }}
summary: Trivy has detected a vulnerability with a Docker container
summary: Trivy Security Alert - ${{ github.repository }}
description: ${{steps.trivy.outputs.html_url}}

- name: Container - Scan - Save Result
Expand All @@ -68,4 +66,3 @@ env:
uses: github/codeql-action/upload-sarif@v1
with:
sarif_file: "trivy-results.sarif"

8 changes: 3 additions & 5 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,9 @@ object Dependencies {
}

val resolvers = Seq(
Resolver.jcenterRepo,
"Atlassian Releases" at "https://maven.atlassian.com/public/",
Resolver.bintrayRepo("scalaz", "releases"),
"HAT Library Artifacts Snapshots" at "https://s3-eu-west-1.amazonaws.com/library-artifacts-snapshots.hubofallthings.com",
"HAT Library Artifacts Releases" at "https://s3-eu-west-1.amazonaws.com/library-artifacts-releases.hubofallthings.com"
"Atlassian" at "https://maven.atlassian.com/public/",
"HAT Library Artifacts Releases" at "https://s3-eu-west-1.amazonaws.com/library-artifacts-releases.hubofallthings.com",
"HAT Library Artifacts Snapshots" at "https://s3-eu-west-1.amazonaws.com/library-artifacts-snapshots.hubofallthings.com"
)

object Library {
Expand Down

0 comments on commit e6a26ea

Please sign in to comment.