Skip to content

Commit

Permalink
Merge pull request #115 from wireapp/staging
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
dkovacevic committed Jul 3, 2023
2 parents 665330a + e72f50f commit 52ad420
Show file tree
Hide file tree
Showing 11 changed files with 3,655 additions and 21,774 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
# https://github.com/docker/build-push-action/issues/220
context: .
tags: wire/ci-test-image
platforms: linux/amd64,linux/arm64
platforms: linux/amd64
push: false

# Send webhook to Wire using Slack Bot
Expand Down
29 changes: 19 additions & 10 deletions .github/workflows/prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
id: docker_build
uses: docker/build-push-action@v2
with:
platforms: linux/amd64,linux/arm64
platforms: linux/amd64
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
# push only if this is indeed a taged release
Expand Down Expand Up @@ -78,18 +78,27 @@ jobs:
# delete bakup file
rm "$SERVICE.yaml.bak"
# Setup gcloud CLI
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v0
- name: Enable auth plugin
run: |
echo "USE_GKE_GCLOUD_AUTH_PLUGIN=True" >> $GITHUB_ENV
# Auth to GKE
- name: Authenticate to GKE
uses: google-github-actions/auth@v1
with:
service_account_email: kubernetes-deployment-agent@wire-bot.iam.gserviceaccount.com
service_account_key: ${{ secrets.GKE_SA_KEY }}
project_id: wire-bot
export_default_credentials: true
credentials_json: ${{ secrets.GKE_SA_KEY }}
service_account: kubernetes-deployment-agent@wire-bot.iam.gserviceaccount.com

# Setup gcloud CLI
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v1

# Configure Docker to use the gcloud command-line tool
- name: Configure Docker Google cloud
# Prepare components
- name: Prepare gcloud components
run: |
gcloud components install gke-gcloud-auth-plugin
gcloud components update
gcloud --quiet auth configure-docker
# Get the GKE credentials so we can deploy to the cluster
Expand Down Expand Up @@ -157,7 +166,7 @@ jobs:
uses: docker/login-action@v1
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
username: wire+roman_github_actions
password: ${{ secrets.QUAY_PASSWORD }}

- name: Build and push
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/quay.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Quay Deployment
name: quay.io image

on:
# manual dispatch
Expand All @@ -9,7 +9,7 @@ on:
required: true
jobs:
publish:
name: Deploy to staging
name: Build and push container
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
Expand All @@ -31,14 +31,14 @@ jobs:
uses: docker/login-action@v1
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
username: wire+roman_github_actions
password: ${{ secrets.QUAY_PASSWORD }}

- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
platforms: linux/amd64,linux/arm64
platforms: linux/amd64
tags: quay.io/wire/roman:${{ github.event.inputs.tag }}
labels: ${{ steps.docker_meta.outputs.labels }}
push: true
Expand Down
28 changes: 19 additions & 9 deletions .github/workflows/staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
id: docker_build
uses: docker/build-push-action@v2
with:
platforms: linux/amd64,linux/arm64
platforms: linux/amd64
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
push: true
Expand All @@ -63,16 +63,26 @@ jobs:
run: |
echo "NEW_IMAGE=${{ env.DOCKER_IMAGE }}@${{ steps.docker_build.outputs.digest }}" >> $GITHUB_ENV
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v0
- name: Enable auth plugin
run: |
echo "USE_GKE_GCLOUD_AUTH_PLUGIN=True" >> $GITHUB_ENV
# Auth to GKE
- name: Authenticate to GKE
uses: google-github-actions/auth@v1
with:
service_account_email: kubernetes-deployment-agent@wire-bot.iam.gserviceaccount.com
service_account_key: ${{ secrets.GKE_SA_KEY }}
project_id: ${{ env.GKE_PROJECT }}
export_default_credentials: true
project_id: wire-bot
credentials_json: ${{ secrets.GKE_SA_KEY }}
service_account: kubernetes-deployment-agent@wire-bot.iam.gserviceaccount.com

# Setup gcloud CLI
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v1

- name: Configure Docker Google cloud
# Prepare components
- name: Prepare gcloud components
run: |
gcloud components install gke-gcloud-auth-plugin
gcloud components update
gcloud --quiet auth configure-docker
- name: Login to K8s
Expand Down Expand Up @@ -137,7 +147,7 @@ jobs:
uses: docker/login-action@v1
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
username: wire+roman_github_actions
password: ${{ secrets.QUAY_PASSWORD }}

- name: Build and push
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ COPY backend/ ./

RUN mvn -Dmaven.test.skip=true package

FROM wirebot/runtime AS runtime
FROM wirebot/runtime:1.3.0 AS runtime
LABEL description="Wire Roman"
LABEL project="wire-bots:roman"

Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ Uses [lithium](https://github.com/wireapp/lithium) to utilize Wire Bot API.

### API documentation:

* Production - [swagger](https://proxy.services.wire.com/swagger#/default)
* Production - [swagger](https://proxy.services.wire.com/api/swagger#/default)
* Staging - [swagger](https://roman.integrations.zinfra.io/api/swagger#/default)

### Register as Wire Bot Developer

- [register](https://proxy.services.wire.com/swagger#!/default/register)
- [register](https://proxy.services.wire.com/api/swagger#!/default/register)

```
{
Expand All @@ -23,7 +23,7 @@ Uses [lithium](https://github.com/wireapp/lithium) to utilize Wire Bot API.

### Login

- [login](https://proxy.services.wire.com/swagger#!/default/login)
- [login](https://proxy.services.wire.com/api/swagger#!/default/login)

```
{
Expand All @@ -34,7 +34,7 @@ Uses [lithium](https://github.com/wireapp/lithium) to utilize Wire Bot API.

### Create a service

- [create service](https://proxy.services.wire.com/swagger#!/default/create)
- [create service](https://proxy.services.wire.com/api/swagger#!/default/create)

```
{
Expand Down Expand Up @@ -77,7 +77,7 @@ request to the `url` you specified when creating the Service. Your webhook shoul
In order to receive events via _Websocket_ connect to:

```
wss://proxy.services.wire.com/await/`<app_key>`
wss://proxy.services.wire.com/api/await/`<app_key>`
```

### Events that are sent as HTTP `POST` to your endpoint (Webhook or Websocket)
Expand Down
8 changes: 4 additions & 4 deletions backend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.wire.bots</groupId>
<artifactId>roman</artifactId>
<version>1.18.1</version>
<version>1.18.2</version>

<name>Roman</name>
<description>Wire Bot API Proxy</description>
Expand All @@ -28,8 +28,8 @@

<maven.test.skip>true</maven.test.skip>

<lithium.version>3.4.2</lithium.version>
<dropwizard.version>2.1.2</dropwizard.version>
<lithium.version>3.5.1</lithium.version>
<dropwizard.version>2.1.4</dropwizard.version>
<jwt.version>0.11.5</jwt.version>
</properties>

Expand All @@ -47,7 +47,7 @@
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.13.4</version>
<version>2.13.4.2</version>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
Expand Down
1 change: 1 addition & 0 deletions backend/src/main/java/com/wire/bots/roman/Sender.java
Original file line number Diff line number Diff line change
Expand Up @@ -239,5 +239,6 @@ private void uploadAssetData(WireClient wireClient, AssetBase asset) throws Exce
final AssetKey assetKey = wireClient.uploadAsset(asset);
asset.setAssetKey(assetKey.id);
asset.setAssetToken(assetKey.token);
asset.setDomain(assetKey.domain);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,10 @@ public Response create(@ApiParam(hidden = true) @CookieParam(Z_ROMAN) String tok
Logger.debug("ServiceResource.create: login status: %d", login.getStatus());

if (login.getStatus() >= 400) {
String msg = login.readEntity(String.class);
Logger.debug("ServiceResource.create: login response: %s", msg);
return Response.
ok(login.readEntity(String.class)).
ok(msg).
status(login.getStatus()).
build();
}
Expand Down Expand Up @@ -102,8 +104,10 @@ public Response create(@ApiParam(hidden = true) @CookieParam(Z_ROMAN) String tok
Logger.debug("ServiceResource.create: create service status: %d", create.getStatus());

if (create.getStatus() >= 400) {
String msg = create.readEntity(String.class);
Logger.debug("ServiceResource.create: create service response: %s", msg);
return Response.
ok(create.readEntity(String.class)).
ok(msg).
status(create.getStatus()).
build();
}
Expand All @@ -115,8 +119,10 @@ public Response create(@ApiParam(hidden = true) @CookieParam(Z_ROMAN) String tok
Logger.debug("ServiceResource.create: enable service status: %d", update.getStatus());

if (update.getStatus() >= 400) {
String msg = update.readEntity(String.class);
Logger.debug("ServiceResource.create: enable service response: %s", msg);
return Response.
ok(update.readEntity(String.class)).
ok(msg).
status(update.getStatus()).
build();
}
Expand Down Expand Up @@ -177,7 +183,7 @@ public Response update(@Context ContainerRequestContext context,

Response login = providerClient.login(provider.email, provider.password);

Logger.debug("ServiceResource.create: login status: %d", login.getStatus());
Logger.debug("ServiceResource.update: login status: %d", login.getStatus());

if (login.getStatus() >= 400) {
return Response.
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ services:
- db

db:
image: postgres:14
image: postgres:13
# just for local development
environment:
- POSTGRES_USER=roman
Expand Down
Loading

0 comments on commit 52ad420

Please sign in to comment.