Skip to content

Commit 7bdcb58

Browse files
author
Bennett Goble
committed
Initial
0 parents  commit 7bdcb58

File tree

14 files changed

+857
-0
lines changed

14 files changed

+857
-0
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.git

.github/release.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
changelog:
2+
exclude:
3+
labels:
4+
- ignore-for-release
5+
authors:
6+
- dependabot
7+
categories:
8+
- title: Breaking Changes 🛠
9+
labels:
10+
- semver-major
11+
- breaking-change
12+
- title: New Features 🎉
13+
labels:
14+
- semver-minor
15+
- enhancement
16+
- title: Other Changes
17+
labels:
18+
- '*'

.github/workflows/test.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Run tests
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main]
7+
8+
jobs:
9+
lint:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: actions/setup-python@v5
14+
with:
15+
python-version: '3.x'
16+
- uses: pre-commit/[email protected]
17+
test:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
with:
22+
submodules: recursive
23+
24+
- name: Execute BATS
25+
run: ./test/bats/bin/bats test/test.bats

.gitmodules

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[submodule "test/bats"]
2+
path = test/bats
3+
url = https://github.com/bats-core/bats-core.git
4+
[submodule "test/test_helper/bats-support"]
5+
path = test/test_helper/bats-support
6+
url = https://github.com/bats-core/bats-support.git
7+
[submodule "test/test_helper/bats-assert"]
8+
path = test/test_helper/bats-assert
9+
url = https://github.com/bats-core/bats-assert.git

.pre-commit-config.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
repos:
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v4.5.0
6+
hooks:
7+
- id: trailing-whitespace
8+
- id: end-of-file-fixer
9+
- id: check-executables-have-shebangs
10+
- id: check-shebang-scripts-are-executable
11+
- id: check-yaml
12+
- id: fix-byte-order-marker
13+
- id: mixed-line-ending
14+
- repo: https://github.com/syntaqx/git-hooks
15+
rev: v0.0.18
16+
hooks:
17+
- id: shellcheck
18+
exclude: test

Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM debian:bookworm-slim
2+
3+
COPY ./with-cloudsmith /usr/bin/
4+
5+
RUN apt-get update \
6+
&& apt-get install -y apt-transport-https ca-certificates curl gnupg \

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Linden Research, Inc.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# with-cloudsmith
2+
3+
**with-cloudsmith** is a CLI tool for temporarily injecting Cloudsmith package
4+
source configurations into an environment. This can be useful when you want
5+
to consume private packages as part of a Dockerfile build but do not want to
6+
leave credentials behind in the resulting image.
7+
8+
## Use
9+
10+
First, add **with-cloudsmith** to your Dockerfile:
11+
```dockerfile
12+
FROM debian:bookworm-slim
13+
14+
ADD https://raw.githubusercontent.com/secondlife/with-cloudsmith/v0.1.0/with-cloudsmith /usr/bin/
15+
```
16+
17+
## Use with debian packages
18+
19+
To install debian packages from a private Cloudsmith repository:
20+
```dockerfile
21+
# Install cloudsmith apt source dependencies
22+
RUN apt-get update \
23+
&& apt-get install -y apt-transport-https ca-certificates curl gnupg \
24+
&& rm -rf /var/lib/apt/lists/*
25+
26+
# Install private dependencies
27+
RUN --mount=type=secret,id=CLOUDSMITH_API_KEY \
28+
with-cloudsmith -v --repo REPO --org ORG --deb \
29+
apt-get install -y PACKAGE \
30+
&& rm -rf /var/lib/apt/lists/*
31+
```
32+
33+
Then, assuming you have the environment variable CLOUDSMITH_API_KEY available, build the image:
34+
```
35+
$ docker build --secret id=CLOUDSMITH_API_KEY local/example .
36+
```
37+
38+
## Use with pip
39+
40+
Private python packages can be installed using **with-cloudsmith** like so:
41+
42+
```dockerfile
43+
RUN --mount=type=secret,id=CLOUDSMITH_API_KEY \
44+
with-cloudsmith --repo REPO --org ORG --pip pip install ...
45+
```
46+
47+
Build the image the same as before, passing a build `--secret`.
48+
49+
### Credentials
50+
51+
**with-cloudsmith** desperately searches the following locations for credentials:
52+
53+
- Environment variables: `CLOUDSMITH_API_KEY`, `CLOUDSMITH_TOKEN`, `CLOUDSMITH_USER`, `CLOUDSMITH_PASSWORD`
54+
- Ini files: `$HOME/.cloudsmith/credentials.ini`, `$HOME/.config/credentials.ini`, `$PWD/credentials.ini`
55+
- Docker build secrets: `/run/secrets/CLOUDSMITH_API_KEY`, et al.
56+
57+
If you wish to use an OIDC token, you will want to use `CLOUDSMITH_TOKEN`.
58+
59+
## Supported registry types
60+
61+
- Debian packages
62+
- Python

test/bats

Submodule bats added at 05b9cbd

test/fixtures.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env bash
2+
3+
JESSIE_OS_RELEASE='PRETTY_NAME="Debian GNU/Linux 8 (jessie)"
4+
NAME="Debian GNU/Linux"
5+
VERSION_ID="8"
6+
VERSION="8 (jessie)"
7+
ID=debian
8+
HOME_URL="http://www.debian.org/"
9+
SUPPORT_URL="http://www.debian.org/support"
10+
BUG_REPORT_URL="https://bugs.debian.org/"'
11+
12+
BOOKWORM_OS_RELEASE='PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
13+
NAME="Debian GNU/Linux"
14+
VERSION_ID="12"
15+
VERSION="12 (bookworm)"
16+
VERSION_CODENAME=bookworm
17+
ID=debian
18+
HOME_URL="https://www.debian.org/"
19+
SUPPORT_URL="https://www.debian.org/support"
20+
BUG_REPORT_URL="https://bugs.debian.org/"'
21+
22+
FOCAL_OS_RELEASE='NAME="Ubuntu"
23+
VERSION="20.04.6 LTS (Focal Fossa)"
24+
ID=ubuntu
25+
ID_LIKE=debian
26+
PRETTY_NAME="Ubuntu 20.04.6 LTS"
27+
VERSION_ID="20.04"
28+
HOME_URL="https://www.ubuntu.com/"
29+
SUPPORT_URL="https://help.ubuntu.com/"
30+
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
31+
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
32+
VERSION_CODENAME=focal
33+
UBUNTU_CODENAME=focal'
34+
35+
PUBLIC_KEY='-----BEGIN PGP PUBLIC KEY BLOCK-----\n\nmQGNBGYdqBwBDACvgTVXPt32ROKR++PnxJEHcSlnJdzegb5zQlz46Fh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