-
Notifications
You must be signed in to change notification settings - Fork 9
131 lines (108 loc) · 5.36 KB
/
test-with-minio.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# workflow_dispatch allows for manual triggering from the GitHub Actions UI, as well
# as the API. repository_dispatch allows us to trigger multiple workflows that
# match on an event_type parameter when triggered via an API call.
# https://docs.github.com/en/actions/reference/events-that-trigger-workflows
on:
pull_request:
workflow_dispatch:
repository_dispatch:
types: [integration_tests]
name: Test Minio as object storage
jobs:
minio-test:
runs-on: ubuntu-latest
env:
# The fake access keys used to configure the Minio container.
# We will use these keys as the AWS access keys so that the
# Pulumi service can connect to the Minio storage service.
MINIO_ROOT_USER: "minio-access-key"
MINIO_ROOT_PASSWORD: "minio-secret-key"
MINIO_HOST: "minio:9000"
MINIO_BUCKET_NAME: "pulumi-checkpoints"
MINIO_PP_BUCKET_NAME: "pulumi-policy-packs"
# When regenerating the license, create a restricted license.
# That is, create a license that has a max unit of just 1 unless
# otherwise required.
PULUMI_LICENSE_KEY: ${{ secrets.PULUMI_LICENSE_KEY }}
steps:
- name: Set env vars
run: |
# There doesn't seem to be a way to map environment variables into other enviroments
# when these are also defined in the same place as the ones they depend on.
# So set those env vars using:
# https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
# The only AWS resource the service will access is the Minio container
# so we map its keys as the AWS keys for the service.
echo "AWS_REGION=us-west-2" >> $GITHUB_ENV
echo "AWS_ACCESS_KEY_ID=${MINIO_ROOT_USER}" >> $GITHUB_ENV
echo "AWS_SECRET_ACCESS_KEY=${MINIO_ROOT_PASSWORD}" >> $GITHUB_ENV
checkpoint_endpoint="s3://${MINIO_BUCKET_NAME}?endpoint=${MINIO_HOST}&disableSSL=true&s3ForcePathStyle=true"
pp_endpoint="s3://${MINIO_PP_BUCKET_NAME}?endpoint=${MINIO_HOST}&disableSSL=true&s3ForcePathStyle=true"
echo "PULUMI_CHECKPOINT_BLOB_STORAGE_ENDPOINT=${checkpoint_endpoint}" >> $GITHUB_ENV
echo "PULUMI_POLICY_PACK_BLOB_STORAGE_ENDPOINT=${pp_endpoint}" >> $GITHUB_ENV
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5
with:
go-version: 1.22
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4
with:
node-version: '18'
- name: Checkout pulumi/pulumi-self-hosted-installers
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Login to Docker Hub as pulumi-bot
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Run Minio
run: |
mkdir -p "${RUNNER_TEMP}/minio-persistence"
docker run -d --name minio \
--publish 9000:9000 \
--volume ${RUNNER_TEMP}/minio-persistence:/data \
--env MINIO_ROOT_USER="${MINIO_ROOT_USER}" \
--env MINIO_ROOT_PASSWORD="${MINIO_ROOT_PASSWORD}" \
bitnami/minio:latest
# Wait until Minio starts up fully.
sleep 20s
docker logs minio
echo "127.0.0.1 minio" | sudo tee -a /etc/hosts
- name: Create Minio buckets
run: |
# https://docs.min.io/docs/minio-client-quickstart-guide.html
wget -q https://dl.min.io/client/mc/release/linux-amd64/mc
chmod +x mc
# Create a new alias called minio for our Minio container.
./mc alias set minio "http://${MINIO_HOST}" "${MINIO_ROOT_USER}" "${MINIO_ROOT_PASSWORD}"
# Create the bucket using the minio alias.
./mc mb "minio/${MINIO_BUCKET_NAME}"
./mc mb "minio/${MINIO_PP_BUCKET_NAME}"
- name: Configure Minio network
run: |
# Connect Minio to the pulumi-self-hosted-installers docker network.
docker network create pulumi-self-hosted-installers
docker network connect pulumi-self-hosted-installers minio
- uses: ./.github/actions/run-self-hosted
timeout-minutes: 5
with:
compose-args: '-f ./quickstart-docker-compose/all-in-one/docker-compose.yml -f ./quickstart-docker-compose/all-in-one/docker-compose.edge.yml'
- name: Run integration tests
run: go test ./quickstart-docker-compose/tests/... -v --tags=minio
- name: Upload service log as artifact
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4
if: ${{ always() }}
with:
name: service-log
path: ${{ env.SERVICE_LOG }}
overwrite: true
- if: failure()
name: Notify Slack
uses: 8398a7/action-slack@v3
env:
# The Slack webhook URL must be specific to the pulumi-service Slack channel.
# The name of the Slack app is "Pulumi Webhooks". You must have access to it
# to be able to see it on https://api.slack.com.
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
with:
text: Minio integration test in pulumi-self-hosted-installers failed for service's latest edge build
fields: job,workflow
status: ${{ job.status }}