Merge pull request #158 from cdalvaro/bugfix/fix_gitfs_tests

Fix gitfs tests
This commit is contained in:
Carlos D. Álvaro
2022-08-26 11:59:29 +02:00
committed by GitHub
4 changed files with 22 additions and 27 deletions

View File

@@ -122,11 +122,13 @@ jobs:
- name: Execute gitfs tests - name: Execute gitfs tests
env: env:
GITFS_KEYS_DIR: tests/gitfs/data/keys/gitfs GITFS_KEYS_DIR: tests/gitfs/data/keys/gitfs
SSH_PRIVATE_KEY: ${{ secrets.TESTS_REPO_PRIVATE_KEY }}
SSH_PUBLIC_KEY: ${{ secrets.TESTS_REPO_PUBLIC_KEY }}
run: | run: |
mkdir -p "${GITFS_KEYS_DIR}" mkdir -p "${GITFS_KEYS_DIR}"
echo "${{ secrets.TESTS_REPO_PRIVATE_KEY }}" > "${GITFS_KEYS_DIR}"/gitfs_ssh echo "${SSH_PRIVATE_KEY}" | base64 -d > "${GITFS_KEYS_DIR}"/gitfs_ssh
chmod 600 "${GITFS_KEYS_DIR}"/gitfs_ssh chmod 600 "${GITFS_KEYS_DIR}"/gitfs_ssh
echo "${{ secrets.TESTS_REPO_PUBLIC_KEY }}" > "${GITFS_KEYS_DIR}"/gitfs_ssh.pub echo "${SSH_PUBLIC_KEY}" | base64 -d > "${GITFS_KEYS_DIR}"/gitfs_ssh.pub
chmod 644 "${GITFS_KEYS_DIR}"/gitfs_ssh.pub chmod 644 "${GITFS_KEYS_DIR}"/gitfs_ssh.pub
tests/gitfs/test.sh tests/gitfs/test.sh

View File

@@ -61,20 +61,19 @@ EXPOSE 4505 4506 8000
RUN mkdir -p "${SALT_BASE_DIR}" "${SALT_FORMULAS_DIR}" "${SALT_KEYS_DIR}" "${SALT_CONFS_DIR}" "${SALT_LOGS_DIR}" RUN mkdir -p "${SALT_BASE_DIR}" "${SALT_FORMULAS_DIR}" "${SALT_KEYS_DIR}" "${SALT_CONFS_DIR}" "${SALT_LOGS_DIR}"
VOLUME [ "${SALT_BASE_DIR}", "${SALT_FORMULAS_DIR}", "${SALT_KEYS_DIR}", "${SALT_CONFS_DIR}", "${SALT_LOGS_DIR}" ] VOLUME [ "${SALT_BASE_DIR}", "${SALT_FORMULAS_DIR}", "${SALT_KEYS_DIR}", "${SALT_CONFS_DIR}", "${SALT_LOGS_DIR}" ]
LABEL \ LABEL org.opencontainers.image.title="Dockerized Salt Master"
org.opencontainers.image.title="Dockerized Salt Master" \ LABEL org.opencontainers.image.description="salt-master ${SALT_VERSION} containerized"
org.opencontainers.image.description="salt-master ${SALT_VERSION} containerized" \ LABEL org.opencontainers.image.documentation="https://github.com/cdalvaro/docker-salt-master/blob/${IMAGE_VERSION}/README.md"
org.opencontainers.image.documentation="https://github.com/cdalvaro/docker-salt-master/blob/${IMAGE_VERSION}/README.md" \ LABEL org.opencontainers.image.url="https://github.com/cdalvaro/docker-salt-master"
org.opencontainers.image.url="https://github.com/cdalvaro/docker-salt-master" \ LABEL org.opencontainers.image.source="https://github.com/cdalvaro/docker-salt-master.git"
org.opencontainers.image.source="https://github.com/cdalvaro/docker-salt-master.git" \ LABEL org.opencontainers.image.authors="Carlos Álvaro <github@cdalvaro.io>"
org.opencontainers.image.authors="Carlos Álvaro <github@cdalvaro.io>" \ LABEL org.opencontainers.image.vendor="cdalvaro"
org.opencontainers.image.vendor=cdalvaro \ LABEL org.opencontainers.image.created="${BUILD_DATE}"
org.opencontainers.image.created=${BUILD_DATE} \ LABEL org.opencontainers.image.version="${IMAGE_VERSION}"
org.opencontainers.image.version="${IMAGE_VERSION}" \ LABEL org.opencontainers.image.revision="${VCS_REF}"
org.opencontainers.image.revision=${VCS_REF} \ LABEL org.opencontainers.image.base.digest="sha256:42ba2dfce475de1113d55602d40af18415897167d47c2045ec7b6d9746ff148f"
org.opencontainers.image.base.digest="sha256:42ba2dfce475de1113d55602d40af18415897167d47c2045ec7b6d9746ff148f" \ LABEL org.opencontainers.image.base.name="ubuntu:jammy-20220801"
org.opencontainers.image.base.name="ubuntu:jammy-20220801" \ LABEL org.opencontainers.image.licenses="MIT"
org.opencontainers.image.licenses=MIT
WORKDIR ${SALT_HOME} WORKDIR ${SALT_HOME}
ENTRYPOINT [ "/sbin/entrypoint.sh" ] ENTRYPOINT [ "/sbin/entrypoint.sh" ]

View File

@@ -13,7 +13,7 @@ help:
build: build:
@docker build --tag=cdalvaro/docker-salt-master:latest . \ @docker build --tag=cdalvaro/docker-salt-master:latest . \
--build-arg=BUILD_DATE="$(shell date +"%Y-%m-%d %H:%M:%S%:z")" \ --build-arg=BUILD_DATE="$(shell date -u +"%Y-%m-%dT%H:%M:%SZ")" \
--build-arg=VCS_REF="$(shell git rev-parse --short HEAD)" --build-arg=VCS_REF="$(shell git rev-parse --short HEAD)"
release: build release: build

View File

@@ -336,7 +336,7 @@ This keys must be placed inside `/home/salt/data/keys` directory.
You can create an ssh key for pygit2 with the following command: You can create an ssh key for pygit2 with the following command:
```sh ```sh
ssh-keygen -f gitfs_ssh -C 'gitfs@example.com' ssh-keygen -t ed25519 -C -f gitfs_ssh -C 'gitfs_ed25519@example.com'
``` ```
Place it wherever you want inside the container and specify its path with the configuration parameters: `gitfs_pubkey` Place it wherever you want inside the container and specify its path with the configuration parameters: `gitfs_pubkey`
@@ -352,18 +352,12 @@ gitfs_pubkey: /home/salt/data/keys/gitfs/gitfs_ssh.pub
**Important Note** **Important Note**
By default, this image has been tested with RSA 4096 ssh keys generated with `ssh-keygen`. This image has been tested with a _ed25519_ ssh key.
If you get the following error while using `gitfs` with `pygit2` Alternately, you may create a new RSA key with SHA2 hashing like so:
```plain
_pygit2.GitError: Failed to authenticate SSH session: Unable to send userauth-publickey request
```
you may have to recreate your ssh key adding the parameter: `-m PEM`:
```sh ```sh
ssh-keygen -m PEM -f gitfs_ssh -C 'gitfs@example.com' ssh-keygen -t rsa-sha2-512 -b 4096 -f gitfs_ssh -C 'gitfs_rsa4096@example.com'
``` ```
### 3rd Party Formulas ### 3rd Party Formulas