Skip to content

Commit

Permalink
ci: add test container image and automation (#664)
Browse files Browse the repository at this point in the history
Signed-off-by: Anton Baliasnikov <[email protected]>
  • Loading branch information
Anton Baliasnikov authored Aug 30, 2023
1 parent b3c0bae commit 24284f8
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 8 deletions.
25 changes: 25 additions & 0 deletions .github/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM ubuntu:22.04

RUN apt-get update && \
apt-get install --no-install-recommends --yes \
git=1:2.* \
curl=7.* \
wget=1.21.* \
unzip=6.* \
zip=3.* \
jq=1.* \
python3=3.10.* \
python3-pip=22.* \
python3-setuptools=59.6.* \
python3-wheel=0.37.* \
gnupg=2.2.* \
default-jre=2:1.* \
build-essential=12.* && \
echo "deb https://repo.scala-sbt.org/scalasbt/debian all main" | tee /etc/apt/sources.list.d/sbt.list && \
echo "deb https://repo.scala-sbt.org/scalasbt/debian /" | tee /etc/apt/sources.list.d/sbt_old.list && \
curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/scalasbt-release.gpg --import && \
chmod 644 /etc/apt/trusted.gpg.d/scalasbt-release.gpg && \
apt-get --allow-releaseinfo-change update && \
apt-get install --no-install-recommends --yes \
sbt=1.4.* \
&& rm -rf /var/lib/apt/lists/*
60 changes: 60 additions & 0 deletions .github/workflows/build-test-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Build Test Docker image

on:
push:
branches: ["main"]
paths:
- ".github/docker/**"
- ".github/workflows/build-test-docker.yml"
pull_request:
paths:
- ".github/docker/**"
- ".github/workflows/build-test-docker.yml"

env:
REGISTRY: ghcr.io
IMAGE_NAME: agent-ci-ubuntu-22-jdk-11

jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Log in to the Container registry
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build Docker image
if: ${{ github.event_name == 'pull_request' }}
uses: docker/build-push-action@v2
with:
context: .github/docker
push: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Build and push Docker image
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
uses: docker/build-push-action@v2
with:
context: .github/docker
push: true
tags: |
"ghcr.io/input-output-hk/${env.IMAGE_NAME}:latest"
"ghcr.io/input-output-hk/${env.IMAGE_NAME}:main"
labels: ${{ steps.meta.outputs.labels }}
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ PORT=${PORT} PRISM_AGENT_VERSION=${PRISM_AGENT_VERSION} PRISM_NODE_VERSION=${PRI
up --wait
```

The `PORT` variable is used to specify the port number for the PRISM Cloud Agent to listen on. The `PRISM_AGENT_VERSION` and `PRISM_NODE_VERSION` variables are used to specify the versions of the PRISM Cloud Agent and PRISM Node to use. The `AGENT_ROLE` variable is used to specify the role of the PRISM Cloud Agent. The `AGENT_ROLE` variable can be set to `issuer`, `verifier` or `holder`.
The `PORT` variable is used to specify the port number for the Cloud Agent to listen on. The `PRISM_AGENT_VERSION` and `PRISM_NODE_VERSION` variables are used to specify the versions of the Cloud Agent and PRISM Node to use. The `AGENT_ROLE` variable is used to specify the role of the Cloud Agent. The `AGENT_ROLE` variable can be set to `issuer`, `verifier` or `holder`.

In real life, you will need to start at least two PRISM Cloud Agent instances with different roles. For example, you can start one instance with the `issuer` role and another one with the `holder` role. The `issuer` instance will be used to issue verifiable credentials (VCs) and the `holder` instance will be used to hold VCs. Here is an example of how you can do this:
In real life, you will need to start at least two Cloud Agent instances with different roles. For example, you can start one instance with the `issuer` role and another one with the `holder` role. The `issuer` instance will be used to issue verifiable credentials (VCs) and the `holder` instance will be used to hold VCs. Here is an example of how you can do this:

```bash
PORT=8080 PRISM_AGENT_VERSION=1.9.2 PRISM_NODE_VERSION=2.2.1 \
Expand All @@ -118,7 +118,7 @@ PORT=8090 PRISM_AGENT_VERSION=1.9.2 PRISM_NODE_VERSION=2.2.1 \
up --wait
```

If the PRISM Cloud Agent is started successfully, all the running containers should achieve `Healthy` state, and Cloud Agent Rest API should be available at the specified port, for example:
If the Cloud Agent is started successfully, all the running containers should achieve `Healthy` state, and Cloud Agent Rest API should be available at the specified port, for example:
* `http://localhost:8080/prism-agent` for the `issuer` instance
* `http://localhost:8090/prism-agent` for the `holder` instance

Expand All @@ -128,9 +128,9 @@ $ curl http://localhost:8080/prism-agent/_system/health
{"version":"1.9.2"}
```

> For more information about all available configuration parameters, please, check [PRISM Cloud Agent configuration](https://docs.atalaprism.io/docs/atala-prism/prism-cloud-agent/environment-variables) section at the documentation portal and edit the `docker-compose-demo.yml` file accordingly.
> For more information about all available configuration parameters, please, check [Cloud Agent configuration](https://docs.atalaprism.io/docs/atala-prism/prism-cloud-agent/environment-variables) section at the documentation portal and edit the `docker-compose-demo.yml` file accordingly.
#### Compatibility between PRISM Cloud Agent and PRISM Node
#### Compatibility between Cloud Agent and PRISM Node

There could be some incompatibilities between the most latest versions of Enterprise Cloud Agent and PRISM Node. Please, use the following table to check the compatibility between the versions:

Expand All @@ -140,9 +140,9 @@ There could be some incompatibilities between the most latest versions of Enterp
| 1.6.0 | 2.1.1 |
| 1.4.0 | 2.1.1 |

> Please note: it is not guaranteed that the latest version of PRISM Cloud Agent will work with the latest version of PRISM Node. We recommend using the versions from the table above.
> Please note: it is not guaranteed that the latest version of Enterprise Cloud Agent will work with the latest version of PRISM Node. We recommend using the versions from the table above.
### Following the PRISM Cloud Agent tutorials
### Following the Enterprise Cloud Agent tutorials

The following tutorials will help you get started with the Cloud Agent and issue your first credentials:

Expand All @@ -159,7 +159,9 @@ More information about Atala and how we work can be found in our handbook at htt

## Contributing

Please read our [contributions guidelines](CONTRIBUTING) and submit your PRs. We enforce [developer certificate of origin (DCO) commit signing](DCO). We also welcome issues submitted about problems you encounter in using PRISM Cloud Agent.
Please read our [contributions guidelines](CONTRIBUTING) and submit your PRs. We enforce [developer certificate of origin (DCO) commit signing](DCO).

We also welcome issues submitted about problems you encounter in using Enterprise Cloud Agent.

## License

Expand Down

0 comments on commit 24284f8

Please sign in to comment.