Skip to content

Commit

Permalink
Migrate from travis to github actions (close #47)
Browse files Browse the repository at this point in the history
  • Loading branch information
istreeter committed Dec 15, 2021
1 parent 5dbd979 commit ff86d7b
Show file tree
Hide file tree
Showing 10 changed files with 140 additions and 157 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: build

on:
push:
tags:
- '*'

jobs:
deploy_docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: coursier/cache-action@v3
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: 8

- name: Get current version
id: ver
run: echo "::set-output name=tag::${GITHUB_REF#refs/tags/}"

- name: Stage the Docker build
run: sbt docker:stage

- name: Docker metadata
id: meta
uses: docker/metadata-action@v3
with:
images: snowplow/snowplow-google-cloud-storage-loader
tags: |
type=raw,value=latest,enable=${{ !contains(steps.ver.outputs.tag, 'rc') }}
type=raw,value=${{ steps.ver.outputs.tag }}
flavor: |
latest=false
- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Push image
uses: docker/build-push-action@v2
with:
context: target/docker/stage
file: target/docker/stage/Dockerfile
platforms: linux/amd64,linux/arm64/v8
tags: ${{ steps.meta.outputs.tags }}
push: true
37 changes: 37 additions & 0 deletions .github/workflows/lacework.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: lacework

on:
push:
tags:
- '*'

jobs:
scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: coursier/cache-action@v3
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: 8
- name: Get current version
id: ver
run: echo "::set-output name=tag::${GITHUB_REF#refs/tags/}"

- name: Install lacework scanner
run: |
sudo apt-get update
sudo apt-get -y install curl
curl -L https://github.com/lacework/lacework-vulnerability-scanner/releases/latest/download/lw-scanner-linux-amd64 -o lw-scanner
chmod +x lw-scanner
- name: Build docker images
run: sbt docker:publishLocal

- name: Scan image
env:
LW_ACCESS_TOKEN: ${{ secrets.LW_ACCESS_TOKEN }}
LW_ACCOUNT_NAME: ${{ secrets.LW_ACCOUNT_NAME }}
LW_SCANNER_SAVE_RESULTS: ${{ !contains(steps.version.outputs.tag, 'rc') }}
run: ./lw-scanner image evaluate snowplow/snowplow-google-cloud-storage-loader ${{ steps.ver.outputs.tag }} --build-id ${{ github.run_id }} --no-pull
25 changes: 25 additions & 0 deletions .github/workflows/snyk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Snyk

on:
push:
branches: [ master ]

jobs:
security:
runs-on: ubuntu-latest

env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install Snyk
run: sudo npm install -g snyk

- name: Add correct sbt-dependency-graph version
run: mkdir -p $HOME/.sbt/1.0/plugins && echo 'addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.10.0-RC1")' >> $HOME/.sbt/1.0/plugins/plugins.sbt

- name: Run Snyk to check for vulnerabilities
run: snyk monitor --project-name=snowplow-google-cloud-storage-loader
16 changes: 16 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: test

on: push

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: coursier/cache-action@v3
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: 8
- name: Run tests
run: sbt test
36 changes: 0 additions & 36 deletions .travis.yml

This file was deleted.

20 changes: 0 additions & 20 deletions .travis/deploy_docker.sh

This file was deleted.

24 changes: 0 additions & 24 deletions .travis/deploy_template.sh

This file was deleted.

32 changes: 0 additions & 32 deletions .travis/release.yml

This file was deleted.

48 changes: 5 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,54 +30,17 @@ sbt docker:publishLocal

## Running

### Through the zip archive

You can find the archive hosted on [our Bintray][bintray].

Once unzipped the artifact can be run as follows:

```bash
./bin/snowplow-google-cloud-storage-loader \
--runner=DataFlowRunner \
--project=[PROJECT] \
--streaming=true \
--zone=europe-west2-a \
--inputSubscription=projects/[PROJECT]/subscriptions/[SUBSCRIPTION] \
--outputDirectory=gs://[BUCKET] \
--outputFilenamePrefix=output \ # optional
--shardTemplate=-W-P-SSSSS-of-NNNNN \ # optional
--outputFilenameSuffix=.txt \ # optional
--windowDuration=5 \ # optional, in minutes
--compression=none \ # optional, gzip, bz2 or none
--numShards=1 \ # optional
--dateFormat=YYYY/MM/dd/HH/ \ # optional
--labels={\"label\": \"value\"} \ #OPTIONAL
--partitionedOuptutDirectory=gs://[BUCKET]/[SUBDIR] # optional
```

To display the help message:

```bash
./bin/snowplow-google-cloud-storage-loader --help
```

To display documentation about Cloud Storage Loader-specific options:

```bash
./bin/snowplow-google-cloud-storage-loader --help=com.snowplowanalytics.storage.googlecloudstorage.loader.Options
```

### Through a docker container

You can also find the image on [our Bintray][bintray-docker].
You can also find the image on [Docker hub][docker-hub].

A container can be run as follows:

```bash
docker run \
-v $PWD/config:/snowplow/config \
-e GOOGLE_APPLICATION_CREDENTIALS=/snowplow/config/credentials.json \ # if running outside GCP
snowplow-docker-registry.bintray.io/snowplow/snowplow-google-cloud-storage-loader:0.3.0 \
snowplow/snowplow-google-cloud-storage-loader:0.3.0 \
--runner=DataFlowRunner \
--jobName=[JOB-NAME] \
--project=[PROJECT] \
Expand All @@ -99,14 +62,14 @@ docker run \
To display the help message:

```bash
docker run snowplow-docker-registry.bintray.io/snowplow/snowplow-google-cloud-storage-loader:0.3.0 \
docker run snowplow/snowplow-google-cloud-storage-loader:0.3.0 \
--help
```

To display documentation about Cloud Storage Loader-specific options:

```bash
docker run snowplow-docker-registry.bintray.io/snowplow/snowplow-google-cloud-storage-loader:0.3.0 \
docker run snowplow/snowplow-google-cloud-storage-loader:0.3.0 \
--help=com.snowplowanalytics.storage.googlecloudstorage.loader.Options
```

Expand Down Expand Up @@ -157,8 +120,7 @@ limitations under the License.
[dataflow]: https://cloud.google.com/dataflow/
[self-describing-json]: https://snowplowanalytics.com/blog/2014/05/15/introducing-self-describing-jsons/

[bintray]: https://bintray.com/snowplow/snowplow-generic/snowplow-google-cloud-storage-loader
[bintray-docker]: https://bintray.com/snowplow/registry/snowplow%3Asnowplow-google-cloud-storage-loader
[docker-hub]: https://hub.docker.com/r/snowplow/snowplow-google-cloud-storage-loader

[license]: http://www.apache.org/licenses/LICENSE-2.0

Expand Down
3 changes: 1 addition & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,8 @@ lazy val macroSettings = Seq(
)

import com.typesafe.sbt.packager.docker._
dockerRepository := Some("snowplow-docker-registry.bintray.io")
dockerUsername := Some("snowplow")
dockerBaseImage := "snowplow-docker-registry.bintray.io/snowplow/k8s-dataflow:0.1.0"
dockerBaseImage := "snowplow/k8s-dataflow:0.1.0"
Docker / maintainer := "Snowplow Analytics Ltd. <[email protected]>"
Docker / daemonUser := "snowplow"
dockerCommands := dockerCommands.value.map{
Expand Down

0 comments on commit ff86d7b

Please sign in to comment.