-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into maintenance-css/T343644
- Loading branch information
Showing
79 changed files
with
1,103 additions
and
191 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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Directory entries are not enough to encrypt fines beneath it | ||
# https://github.com/AGWA/git-crypt#gitattributes-file | ||
quarry/config-prod.yaml filter=git-crypt diff=git-crypt | ||
tofu/secrets.tf filter=git-crypt diff=git-crypt | ||
helm-quarry/prod-config.yaml filter=git-crypt diff=git-crypt | ||
secrets.sh filter=git-crypt diff=git-crypt |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--- | ||
|
||
name: Build and Push quarry image | ||
|
||
'on': | ||
pull_request_target: | ||
|
||
jobs: | ||
build_and_push: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: git fetch | ||
run: | | ||
git fetch | ||
- name: git checkout | ||
run: | | ||
git checkout ${{ github.head_ref }} | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to Quay.io | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: quay.io | ||
username: ${{ secrets.QUAY_QUARRY_USER }} | ||
password: ${{ secrets.QUAY_QUARRY_PASSWORD }} | ||
|
||
- name: Build and push | ||
id: docker_build | ||
uses: docker/build-push-action@v5 | ||
with: | ||
push: true | ||
context: . | ||
tags: quay.io/wikimedia-quarry/quarry:pr-${{ github.event.number }} | ||
|
||
- name: Image digest | ||
run: echo ${{ steps.docker_build.outputs.digest }} |
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
|
||
name: "linter" | ||
|
||
'on': | ||
pull_request: | ||
|
||
jobs: | ||
tox: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: build tox container | ||
run: | | ||
docker build -f tests/tox/Dockerfile -t tox:01 . | ||
- name: run tox container | ||
run: | | ||
docker run tox:01 |
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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
--- | ||
|
||
name: update container tags | ||
|
||
'on': | ||
pull_request_target: | ||
|
||
jobs: | ||
update-container-tags: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | ||
repository: ${{ github.event.pull_request.head.repo.full_name }} | ||
|
||
- name: git fetch | ||
run: | | ||
git fetch | ||
- name: git checkout | ||
run: | | ||
git checkout ${{ github.head_ref }} | ||
# compare to upstream main branch | ||
- name: git add remote | ||
run: | | ||
git remote add quarry https://github.com/toolforge/quarry.git | ||
- name: git remote update | ||
run: | | ||
git remote update | ||
- name: update values.yaml | ||
run: | | ||
for i in web worker ; do | ||
sed -i "s/tag: .* # ${i} tag managed by github actions$/tag: pr-${{ github.event.number }} # ${i} tag managed by github actions/" helm-quarry/values.yaml | ||
done | ||
- uses: EndBug/add-and-commit@v7 | ||
with: | ||
add: 'helm-quarry/values.yaml' | ||
author_name: Github Action | ||
author_email: [email protected] | ||
branch: ${{ github.head_ref }} | ||
message: 'auto update of ${{ inputs.imagename }} tag' | ||
pull: --rebase --autostash |
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
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,30 +1,24 @@ | ||
# Use official python base image, small and debian edition | ||
FROM amd64/python:3.7.3-slim | ||
|
||
ARG purpose=dev | ||
|
||
# Update debian packages | ||
RUN apt-get update && \ | ||
apt-get upgrade -y | ||
FROM amd64/python:3.7.16-slim | ||
|
||
# Create Quarry user, create /results folder owned by this user, | ||
# to be mounted as volume to be shared between web and runner | ||
# to be mounted as volume to be shared between web and runner in dev setup | ||
RUN useradd -r -m quarry && \ | ||
mkdir /results && \ | ||
chown -R quarry: /results | ||
|
||
WORKDIR /app | ||
|
||
COPY requirements.txt /app | ||
# Install python or test dependencies | ||
RUN if [ ${purpose} = "test" ] ; then apt-get install -y tox redis-server; \ | ||
else pip install --upgrade pip wheel && \ | ||
pip install -r requirements.txt; fi | ||
# Install dependencies | ||
RUN pip install --upgrade pip wheel && \ | ||
pip install -r requirements.txt | ||
|
||
# Copy app code | ||
USER quarry | ||
COPY . /app | ||
|
||
# Run web server | ||
# Expose port for web server | ||
EXPOSE 5000 | ||
ENTRYPOINT ["python", "quarry.wsgi"] | ||
|
||
# Entrypoint is set elsewhere, as it's different for web and worker |
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
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[defaults] | ||
# Better error output | ||
stdout_callback=debug | ||
stderr_callback=debug | ||
|
||
collections_path=./collections/ansible_collections | ||
|
||
# we're only using localhost, no need for the warning. | ||
localhost_warning=False | ||
|
||
[inventory] | ||
# Only using localhost, so no inventory | ||
inventory_unparsed_warning=False |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
|
||
- name: Deploy quarry to k8s cluster | ||
gather_facts: false | ||
hosts: localhost | ||
tasks: | ||
- name: Deploy quarry | ||
kubernetes.core.helm: | ||
name: quarry | ||
chart_ref: ../helm-quarry | ||
release_namespace: "quarry" | ||
create_namespace: true | ||
values_files: | ||
- ../helm-quarry/prod-env.yaml |
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
if ! command -v kubectl ; then | ||
echo "please install kubectl" | ||
exit 1 | ||
fi | ||
|
||
if ! command -v helm ; then | ||
echo "please install helm" | ||
exit 1 | ||
fi | ||
|
||
if ! command -v tofu; then | ||
echo "please install tofu" | ||
exit 1 | ||
fi | ||
|
||
source secrets.sh | ||
|
||
python3 -m venv .venv/deploy | ||
source .venv/deploy/bin/activate | ||
pip install ansible==8.1.0 kubernetes==26.1.0 | ||
# install helm diff. Needed to keep helm module idempotent | ||
helm plugin install https://github.com/databus23/helm-diff || true | ||
|
||
cd tofu | ||
AWS_ACCESS_KEY_ID=${ACCESS_KEY} AWS_SECRET_ACCESS_KEY=${SECRET_KEY} tofu init | ||
AWS_ACCESS_KEY_ID=${ACCESS_KEY} AWS_SECRET_ACCESS_KEY=${SECRET_KEY} tofu apply # -auto-approve | ||
export KUBECONFIG=$(pwd)/kube.config | ||
|
||
cd ../ansible | ||
# install collections here to take advantage of ansible.cfg configs | ||
ansible-galaxy collection install -U kubernetes.core -p ./collections | ||
|
||
ansible-playbook quarry.yaml | ||
#kubectl create namespace quarry --dry-run=client -o yaml | kubectl apply -f - | ||
#helm -n quarry upgrade --install quarry helm-quarry -f helm-quarry/prod-env.yaml | ||
|
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
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM mariadb:10.4-focal | ||
|
||
COPY replica.sql /docker-entrypoint-initdb.d/replica.sql |
Oops, something went wrong.