feat: add personal_access_tokens route #153
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
name: default | |
on: | |
push: | |
branches: [main] | |
tags-ignore: | |
- "*" | |
pull_request: | |
branches: [main] | |
workflow_dispatch: | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: "16.15.0" | |
- name: Lint nginx conf files | |
run: |- | |
npm install -g nginx-linter | |
nginx-linter --include "nginx-proxy/**/*.conf" | |
- name: ShellCheck | |
run: |- | |
shellcheck --source-path=./tests ./tests/* | |
test-proxy-image: | |
runs-on: ubuntu-latest | |
services: | |
registry: | |
image: registry:2 | |
ports: | |
- 5000:5000 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
driver-opts: network=host | |
- name: Docker build | |
uses: docker/build-push-action@v3 | |
with: | |
push: true | |
tags: localhost:5000/gitlab-proxy:latest | |
file: ./nginx-proxy/Dockerfile | |
context: ./nginx-proxy | |
- name: Inspect docker image | |
run: | | |
docker buildx imagetools inspect localhost:5000/gitlab-proxy:latest | |
- name: Set up tests | |
id: set_up_tests | |
working-directory: ./nginx-proxy | |
run: |- | |
cp .env.example /tmp/env | |
echo "allow all;" > /tmp/ip_restriction.conf | |
private_token=$(openssl rand -base64 18) | |
echo ::set-output name=PRIVATE_TOKEN::${private_token} | |
gitlab_token=${{ secrets.GITLAB_TOKEN }} | |
{ | |
echo ' map $http_PRIVATE_TOKEN $gitlab_token {' | |
echo ' default "";' | |
echo ' "'${private_token}'" "'${gitlab_token}'";' | |
echo ' }' | |
} >> /tmp/api_keys.conf | |
groupID=12045471 | |
projectID=38029428 | |
echo ::set-output name=GROUP_ID::${groupID} | |
echo ::set-output name=PROJECT_ID::${projectID} | |
echo ::set-output name=PROXY_BASE_PATH::"http://0.0.0.0:8080/api/v4" | |
- name: Run gitlab-proxy | |
run: |- | |
docker run \ | |
-d \ | |
--env-file /tmp/env \ | |
-v /tmp/api_keys.conf:/etc/nginx/api_keys/api_keys.conf:ro \ | |
-v /tmp/ip_restriction.conf:/etc/nginx/proxy/ip_restriction.conf:ro \ | |
-p 8080:80 localhost:5000/gitlab-proxy:latest | |
- name: Tests | |
env: | |
PRIVATE_TOKEN: ${{ steps.set_up_tests.outputs.PRIVATE_TOKEN }} | |
GROUP_ID: ${{ steps.set_up_tests.outputs.GROUP_ID }} | |
PROJECT_ID: ${{ steps.set_up_tests.outputs.PROJECT_ID }} | |
PROXY_BASE_PATH: ${{ steps.set_up_tests.outputs.PROXY_BASE_PATH }} | |
run: |- | |
bash <(curl -s https://raw.githubusercontent.com/pgrange/bash_unit/master/install.sh) | |
./bash_unit tests/* |