Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix branches and tags #26

Merged
merged 5 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions repo-converter/build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# syntax=docker/dockerfile:1
# Using version:1 means always getting the latest version of dockerfile syntax within major version 1
# https://docs.docker.com/build/dockerfile/frontend/#stable-channel
# version:1 is still the most popular version
# https://sourcegraph.com/search?q=context:global+%23+syntax%3Ddocker/dockerfile:(.*)&patternType=regexp&sm=0&expanded=&groupBy=group

# Using Ubuntu LTS
FROM ubuntu:22.04 as base
Expand All @@ -14,6 +18,9 @@ ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1

# Install packages
# default-jre needed for Atlassian's svn-migration-scripts.jar
# default-jre \
# gcc and python3-dev needed for psutils
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install --no-install-recommends -y \
Expand All @@ -33,14 +40,14 @@ RUN apt-get update && \
systemctl enable cron && \
systemctl start cron


# Download dependencies as a separate step to take advantage of Docker's caching
# Leverage a cache mount to /root/.cache/pip to speed up subsequent builds
# Leverage a bind mount to requirements.txt to avoid having to copy them into
# into this layer
# Install requirements
RUN --mount=type=cache,target=/root/.cache/pip \
--mount=type=bind,source=requirements.txt,target=requirements.txt \
python3 -m pip install --upgrade pip && \
python3 -m pip install -r requirements.txt

# # Create sourcegraph user
Expand All @@ -49,7 +56,7 @@ RUN --mount=type=cache,target=/root/.cache/pip \

# Copy the source code into the container
WORKDIR /sourcegraph
COPY . .
COPY run.py .

# Start the container
CMD ["/usr/bin/python3", "/sourcegraph/run.py"]
25 changes: 25 additions & 0 deletions repo-converter/build/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

set -o errexit

clear

pipreqs --force --mode gt .

export BUILD_BRANCH="$(git rev-parse --abbrev-ref HEAD)"
export BUILD_COMMIT="$(git rev-parse --short HEAD)"
export BUILD_DATE="$(date -u +'%Y-%m-%d %H:%M:%S')"
export BUILD_DIRTY="$(git diff --quiet && echo 'False' || echo 'True')"
export BUILD_TAG="$(git tag --points-at HEAD)"

docker compose up -d --build


if [ "$1" != "" ]
then

clear

docker compose logs repo-converter -f

fi
4 changes: 2 additions & 2 deletions repo-converter/build/docker-compose-override.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ services:

src-serve-git:
# Uses a valid hostname as container_name, to trick the cloud agent and code host config into finding this container on the Docker network
container_name: src-serve-git-ubuntu.local
command: "serve-git -addr :443 /sourcegraph/src-serve-root"
container_name: src-serve-git-wsl.local
command: "-v serve-git -addr :443 /sourcegraph/src-serve-root"
8 changes: 7 additions & 1 deletion repo-converter/build/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,10 @@ services:
- REPO_CONVERTER_INTERVAL_SECONDS=60
- LOG_LEVEL=DEBUG # DEBUG INFO WARNING ERROR CRITICAL # Default is INFO
# - REPOS_TO_CONVERT="/sourcegraph/repos-to-convert.yaml" # Path inside the container to find this file, only change to match if the right side of the volume mapping changes
# - SRC_SERVE_ROOT="/sourcegraph/src-serve-root" # Path inside the container to find this directory, only change to match if the right side of the volume mapping changes
# - SRC_SERVE_ROOT="/sourcegraph/src-serve-root" # Path inside the container to find this directory, only change to match if the right side of the volume mapping changes
# Leave these environment variables as is, and define them in ./build.sh
- BUILD_BRANCH
- BUILD_COMMIT
- BUILD_DATE
- BUILD_DIRTY
- BUILD_TAG
7 changes: 5 additions & 2 deletions repo-converter/build/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
psutil
PyYAML
GitPython>=3.1.42
GitPython>=3.1.42
psutil>=5.9.8
PyYAML>=6.0.1
PyYAML>=6.0.1
Loading