Skip to content

[DO NOT MERGE] Log control service command #2662

[DO NOT MERGE] Log control service command

[DO NOT MERGE] Log control service command #2662

Workflow file for this run

---
name: CI
on: # yamllint disable-line rule:truthy
pull_request: # yamllint disable-line rule:empty-values
jobs:
lint-receptor:
name: lint-receptor
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
cache: false
go-version: '1.20'
- name: golangci-lint
uses: golangci/golangci-lint-action@v4
with:
version: v1.56
lint-receptorctl:
name: lint-receptorctl
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup up python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install tox
run: pip install tox
- name: Run receptorctl linters
run: make receptorctl-lint
receptor:
name: receptor (Go ${{ matrix.go-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
go-version: ["1.20"]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: build and install receptor
run: |
make build-all
sudo cp ./receptor /usr/local/bin/receptor
- name: Download kind binary
run: curl -Lo ./kind https://kind.sigs.k8s.io/dl/latest/kind-linux-amd64 && chmod +x ./kind
- name: Create k8s cluster
run: ./kind create cluster
- name: Interact with the cluster
run: kubectl get nodes
- name: Run receptor tests
run: make test
- name: get k8s logs
if: ${{ failure() }}
run: .github/workflows/artifact-k8s-logs.sh
- name: remove sockets before archiving logs
if: ${{ failure() }}
run: find /tmp/receptor-testing -name controlsock -delete
- name: Artifact receptor data
uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: test-logs
path: /tmp/receptor-testing
- name: Archive receptor binary
uses: actions/upload-artifact@v4
with:
name: receptor
path: /usr/local/bin/receptor
receptorctl:
name: receptorctl (Python ${{ matrix.python-version }})
needs: receptor
strategy:
matrix:
os-version: ["ubuntu-22.04"]
python-version: ["3.8", "3.9", "3.10", "3.11"]
runs-on: "${{ matrix.os-version }}"
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download receptor
uses: actions/download-artifact@v4
with:
name: receptor
path: /usr/local/bin/
- name: Fix permissions on receptor binary
run: sudo chmod a+x /usr/local/bin/receptor
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "${{ matrix.python-version }}"
- name: Upgrade pip
run: pip install --upgrade pip
- name: Install tox
run: pip install tox
- name: Run receptorctl tests
run: make receptorctl-test
container:
name: container
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install python dependencies
run: pip install build
- name: Build container
run: make container REPO=receptor LATEST=yes
- name: Write out basic config
run: |
cat << EOF > test.cfg
---
- local-only:
- control-service:
service: control
filename: /tmp/receptor.sock
- work-command:
worktype: cat
command: cat
EOF
- name: Run receptor (and wait a few seconds for it to boot)
run: |
podman run --name receptor -d -v $PWD/test.cfg:/etc/receptor/receptor.conf:Z localhost/receptor
sleep 3
podman logs receptor
- name: Submit work and assert the output we expect
run: |
output=$(podman exec -i receptor receptorctl work submit cat -l 'hello world' -f)
echo $output
if [[ "$output" != "hello world" ]]; then
echo "Output did not contain expected value"
exit 1
fi