-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a4de2bc
commit 8633a1c
Showing
2 changed files
with
68 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,9 @@ name: locust | |
|
||
on: | ||
push: | ||
branches: [ master ] | ||
branches: | ||
- master | ||
- feature/* | ||
paths: | ||
- 'locust/**' | ||
|
||
|
@@ -14,18 +16,43 @@ jobs: | |
runs-on: ubuntu-latest | ||
if: github.ref == 'refs/heads/master' # Running this job only for master branch | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
# steps: | ||
# - uses: actions/checkout@v2 | ||
|
||
- name: Build image | ||
run: docker build --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}" locust/ | ||
# - name: Build image | ||
# run: docker build --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}" locust/ | ||
|
||
- name: Log into registry | ||
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | ||
# - name: Log into registry | ||
# run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | ||
|
||
- name: Push image | ||
run: | | ||
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME | ||
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') | ||
docker tag $IMAGE_NAME $IMAGE_ID:latest | ||
docker push $IMAGE_ID:latest | ||
# - name: Push image | ||
# run: | | ||
# IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME | ||
# IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') | ||
# docker tag $IMAGE_NAME $IMAGE_ID:latest | ||
# docker push $IMAGE_ID:latest | ||
|
||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: Inject slug/short variables | ||
uses: rlespinasse/[email protected] | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to GitHub Container Repository | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push Container Image to GitHub Container Repository | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
push: true | ||
tags: ghcr.io/base2services/locust:snapshot_${{env.GITHUB_REF_SLUG}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,35 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
set -ex | ||
|
||
if [ "x" != "${LOCUST_S3_PATH}x" ] ; then | ||
aws s3 cp s3://${LOCUST_S3_PATH}/${LOCUST_LOCUSTFILE} . --region ${AWS_REGION} | ||
chmod +x ${LOCUST_LOCUSTFILE} | ||
aws s3 cp s3://${LOCUST_S3_PATH} /locust/ --recursive --region ${AWS_REGION} | ||
|
||
LOCUST_MODE=${LOCUST_MODE:-standalone} | ||
LOCUST_MASTER_BIND_PORT=${LOCUST_MASTER_BIND_PORT:-5557} | ||
LOCUST_FILE=${LOCUST_FILE:-locustfile.py} | ||
LOCUST_LOG_LEVEL=${LOCUST_LOG_LEVEL:-INFO} | ||
|
||
LOCUST_OPTS="-f ${LOCUST_FILE} --no-reset-stats" | ||
|
||
if [ -z ${HOST_URL+x} ] ; then | ||
echo "No value set for (HOST_URL), falling back to host value in the locust class" | ||
else | ||
echo "(HOST_URL) set to ${HOST_URL}" | ||
LOCUST_OPTS="--host=${HOST_URL} $LOCUST_OPTS" | ||
fi | ||
|
||
if [ ${1} = "locust" ] ; then | ||
echo "Starting locust......." | ||
if [ -z ${LOCUST_HOST+x} ] ; then | ||
echo "You need to set the URL of the host to be tested (LOCUST_HOST)." | ||
case `echo ${LOCUST_MODE} | tr 'a-z' 'A-Z'` in | ||
"MASTER") | ||
LOCUST_OPTS="--master --master-bind-port=${LOCUST_MASTER_BIND_PORT} $LOCUST_OPTS" | ||
;; | ||
|
||
"SLAVE") | ||
LOCUST_OPTS="--slave --master-host=${LOCUST_MASTER} --master-port=${LOCUST_MASTER_BIND_PORT} $LOCUST_OPTS" | ||
if [ -z ${LOCUST_MASTER+x} ] ; then | ||
echo "You need to set LOCUST_MASTER." | ||
exit 1 | ||
fi | ||
fi | ||
exec "$@" | ||
;; | ||
esac | ||
|
||
exec "$@" ${LOCUST_OPTS} |