diff --git a/.github/workflows/docker_test.yaml b/.github/workflows/docker_test.yaml index ec9b64f..2086f33 100644 --- a/.github/workflows/docker_test.yaml +++ b/.github/workflows/docker_test.yaml @@ -2,6 +2,9 @@ name: Manual Docker Build and Publish on: workflow_dispatch: # This enables manual trigger from GitHub UI or API + push: + branches: + - main jobs: build_and_publish: @@ -48,4 +51,4 @@ jobs: context: "{{defaultContext}}:docker" file: ./Dockerfile push: true - tags: pixeematt/pixee-cli:latest, pixeematt/pixee-cli:${{ steps.bump-semver.outputs.new_version }} + tags: codemodder/pixee-cli:latest, codemodder/pixee-cli:${{ steps.bump-semver.outputs.new_version }} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 8c1d340..5d488c1 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -39,4 +39,4 @@ jobs: steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 - - uses: pre-commit/action@v3.0.0 + - uses: pre-commit/action@v3.0.1 diff --git a/README.md b/README.md index e0072e4..67f2b9c 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,15 @@ To simply scan some code and see possible changes to make: pixee fix /my/project/directory/ ``` +## Docker Usage + +Pixee can also be run in a Docker container. This is useful if you want to run Pixee on an oerating system that does not support brew, or a CI/CD pipeline or in a containerized environment. + +``` +docker run --rm -it -v "${PWD}:/src" codemodder/pixee-cli fix /src + +``` + ## F.A.Q. ### What languages are supported for fixes? diff --git a/ci/bitbucket/Dockerfile b/ci/bitbucket/Dockerfile index 5f5f619..465d3b2 100644 --- a/ci/bitbucket/Dockerfile +++ b/ci/bitbucket/Dockerfile @@ -1,4 +1,4 @@ -FROM codemodder/pixee-cli:0.0.1 +FROM codemodder/pixee-cli:0.8.5 COPY . /pixee/bitbucket WORKDIR /pixee/bitbucket RUN pip install whatthepatch load_dotenv diff --git a/ci/examples/bitbucket-pipelines.yml b/ci/examples/bitbucket-pipelines.yml index a3ff114..5e00f11 100644 --- a/ci/examples/bitbucket-pipelines.yml +++ b/ci/examples/bitbucket-pipelines.yml @@ -1,5 +1,6 @@ image: atlassian/default-image:4 + pipelines: pull-requests: '**': # This will run for pull requests targeting any branch diff --git a/ci/gitlab/Dockerfile b/ci/gitlab/Dockerfile index c542e5f..f3d50f2 100644 --- a/ci/gitlab/Dockerfile +++ b/ci/gitlab/Dockerfile @@ -1,4 +1,4 @@ -FROM codemodder/pixee-cli:0.0.1 +FROM codemodder/pixee-cli:0.8.5 COPY . /pixee/gitlab WORKDIR /pixee/gitlab RUN pip install -r requirements.txt diff --git a/ci/gitlab/pipeline.py b/ci/gitlab/pipeline.py index fa50ce7..fa255dd 100644 --- a/ci/gitlab/pipeline.py +++ b/ci/gitlab/pipeline.py @@ -8,7 +8,9 @@ # GitLab settings + gitlab_url = os.environ.get("GITLAB_API_URL", "https://gitlab.com") + api_token = os.environ.get("GITLAB_API_TOKEN_PIXEE") project_id = os.environ.get("CI_MERGE_REQUEST_PROJECT_ID") or os.environ.get( "CI_PROJECT_ID" diff --git a/docker/Dockerfile b/docker/Dockerfile index fee4774..4a80808 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,21 +1,17 @@ FROM python:3.11-rc-bullseye WORKDIR /pixee -RUN apt-get update +ENV CODEMODDER_JAVA_VERSION=0.75.1 -# Install Python 3, pip and wget -RUN apt-get install -y wget unzip openjdk-17-jre - -RUN ln -s /usr/bin/python3 /usr/bin/python && \ - java -version && \ - python --version && \ - python3 -m pip install semgrep==1.15.0 && \ - python3 -m pip install codemodder - -RUN wget https://github.com/pixee/codemodder-java/releases/download/v0.72.2/codemodder-java-codemods-0.72.2.zip -RUN unzip codemodder-java-codemods-0.72.2.zip +RUN apt-get update && apt-get --no-install-recommends install -y wget unzip openjdk-17-jre && apt-get clean && rm -rf /var/lib/apt/lists/* +RUN wget --max-redirect=1 "https://github.com/pixee/codemodder-java/releases/download/v${CODEMODDER_JAVA_VERSION}/codemodder-java-codemods-${CODEMODDER_JAVA_VERSION}.zip" +RUN unzip codemodder-java-codemods-*.zip && rm codemodder-java-codemods-*.zip RUN python3 -m pip install pixee COPY bin ./bin ENV PATH="${PATH}:/pixee/bin" + +WORKDIR /src + +ENTRYPOINT ["pixee"] diff --git a/pyproject.toml b/pyproject.toml index bfb6dfa..7083bd2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,7 +11,7 @@ readme = "README.md" license = {file = "LICENSE"} description = "Pixee CLI" dependencies = [ - "codemodder==0.91.0", + "codemodder==0.100.0", "click", "prompt-toolkit", "questionary~=2.0.0",