Skip to content

Commit 3d79bbe

Browse files
authored
Merge pull request #7 from manala/cleanup
Cleanup
2 parents 342dfdc + c1ea639 commit 3d79bbe

File tree

7 files changed

+79
-65
lines changed

7 files changed

+79
-65
lines changed

.github/workflows/release.yaml

+14-23
Original file line numberDiff line numberDiff line change
@@ -12,32 +12,24 @@ jobs:
1212
if: github.event.head_commit.message == 'Release'
1313
steps:
1414

15-
- name: Notify Slack - Starting
16-
uses: act10ns/slack@v2
17-
with:
18-
status: starting
19-
channel: '#collection_release'
20-
env:
21-
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
22-
2315
- name: Checkout
2416
uses: actions/checkout@v4
2517

2618
- name: Set ansible galaxy token
2719
run: |
28-
cat << EOF > ./galaxy_token
20+
cat << EOF > galaxy_token
2921
token: ${{ secrets.ANSIBLE_GALAXY_TOKEN }}
3022
EOF
3123
3224
- name: Set up system
3325
uses: ./.manala/github/system/setup
3426

35-
- name: Get metadata from galaxy.yml
36-
id: metadata
37-
uses: CumulusDS/[email protected]
38-
with:
39-
file: galaxy.yml
40-
version: version
27+
- name: Get version
28+
id: version
29+
run: |
30+
cat << EOF > $GITHUB_OUTPUT
31+
version=$(make version)
32+
EOF
4133
4234
- name: Build
4335
id: build
@@ -47,9 +39,8 @@ jobs:
4739
- name: Upload build artifact
4840
uses: actions/upload-artifact@v4
4941
with:
50-
path: ./manala-path-${{ steps.metadata.outputs.version }}.tar.gz
51-
name: manala-path-${{ steps.metadata.outputs.version }}
52-
retention-days: 1
42+
path: build/manala-path-${{ steps.version.outputs.version }}.tar.gz
43+
name: manala-path-${{ steps.version.outputs.version }}.tar.gz
5344

5445
- name: Publish
5546
id: publish
@@ -60,17 +51,17 @@ jobs:
6051
id: changelog
6152
uses: mindsers/changelog-reader-action@v2
6253
with:
63-
path: ./CHANGELOG.md
64-
version: ${{ steps.metadata.outputs.version }}
54+
path: CHANGELOG.md
55+
version: ${{ steps.version.outputs.version }}
6556

6657
- name: Create GitHub Release
6758
id: release
6859
uses: ncipollo/release-action@v1
6960
with:
70-
name: manala-path ${{ steps.metadata.outputs.version }}
71-
tag: ${{ steps.metadata.outputs.version }}
61+
name: ${{ steps.version.outputs.version }}
62+
tag: ${{ steps.version.outputs.version }}
7263
body: ${{ steps.changelog.outputs.changes }}
73-
artifacts: ./manala-path-${{ steps.metadata.outputs.version }}.tar.gz
64+
artifacts: build/manala-path-${{ steps.version.outputs.version }}.tar.gz
7465
token: ${{ secrets.GITHUB_TOKEN }}
7566
skipIfReleaseExists: true
7667

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1+
build/
12
.env.local
23
galaxy_token
3-
manala-path-*

.manala/docker/Dockerfile

+26-15
Original file line numberDiff line numberDiff line change
@@ -12,51 +12,62 @@ ARG MANALA_GROUP_ID="1000"
1212
ARG GOSU_VERSION="1.17"
1313
ARG GOMPLATE_VERSION="4.1.0"
1414
ARG DIRENV_VERSION="2.34.0"
15+
ARG JQ_VERSION="1.7.1"
16+
ARG YQ_VERSION="4.44.3"
1517

1618
# The 'container' environment variable tells systemd that it's running inside a
1719
# Docker container environment.
1820
# It's also internally used for checking we're running inside a container.
1921
ENV container="docker"
2022

2123
# Default locale
22-
ENV LANG C.UTF-8
24+
ENV LANG="C.UTF-8"
2325

2426
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
2527

2628
RUN \
2729
apt-get --quiet update \
2830
&& apt-get --quiet --yes --purge --autoremove upgrade \
2931
&& apt-get --quiet --yes --no-install-recommends --verbose-versions install \
30-
s6 \
31-
sudo \
32-
curl \
33-
ca-certificates \
34-
gnupg \
35-
libarchive-tools bzip2 \
3632
bash-completion \
37-
rsync \
33+
bzip2 \
34+
ca-certificates \
35+
curl \
3836
git \
39-
make \
37+
gnupg \
4038
less \
41-
vim \
39+
libarchive-tools \
40+
make \
41+
rsync \
42+
s6 \
4243
socat \
44+
sudo \
45+
vim \
4346
# User
4447
&& addgroup --gid ${MANALA_GROUP_ID} lazy \
4548
&& adduser --home /home/lazy --shell /bin/bash --uid ${MANALA_USER_ID} --gecos lazy --ingroup lazy --disabled-password lazy \
4649
&& install --verbose --mode 0755 --group lazy --owner lazy --directory /run/user/${MANALA_USER_ID} \
4750
&& echo "lazy ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/lazy \
4851
# Gosu
49-
&& curl -sSL "https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-$(case $(dpkg --print-architecture) in "amd64") echo "amd64" ;; "arm64") echo "arm64" ;; esac)" \
52+
&& curl -sSLf "https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-$(case $(dpkg --print-architecture) in "amd64") echo "amd64" ;; "arm64") echo "arm64" ;; esac)" \
5053
--output /usr/local/bin/gosu \
5154
&& chmod +x /usr/local/bin/gosu \
5255
# Gomplate
53-
&& curl -sSL "https://github.com/hairyhenderson/gomplate/releases/download/v${GOMPLATE_VERSION}/gomplate_linux-$(case $(dpkg --print-architecture) in "amd64") echo "amd64" ;; "arm64") echo "arm64" ;; esac)" \
56+
&& curl -sSLf "https://github.com/hairyhenderson/gomplate/releases/download/v${GOMPLATE_VERSION}/gomplate_linux-$(case $(dpkg --print-architecture) in "amd64") echo "amd64" ;; "arm64") echo "arm64" ;; esac)" \
5457
--output /usr/local/bin/gomplate \
5558
&& chmod +x /usr/local/bin/gomplate \
5659
# Direnv
57-
&& curl -sSL "https://github.com/direnv/direnv/releases/download/v${DIRENV_VERSION}/direnv.linux-$(case $(dpkg --print-architecture) in "amd64") echo "amd64" ;; "arm64") echo "arm64" ;; esac)" \
60+
&& curl -sSLf "https://github.com/direnv/direnv/releases/download/v${DIRENV_VERSION}/direnv.linux-$(case $(dpkg --print-architecture) in "amd64") echo "amd64" ;; "arm64") echo "arm64" ;; esac)" \
5861
--output /usr/local/bin/direnv \
5962
&& chmod +x /usr/local/bin/direnv \
63+
# Jq
64+
&& curl -sSLf "https://github.com/jqlang/jq/releases/download/jq-${JQ_VERSION}/jq-linux-$(case $(dpkg --print-architecture) in "amd64") echo "amd64" ;; "arm64") echo "arm64" ;; esac)" \
65+
--output /usr/local/bin/jq \
66+
&& chmod +x /usr/local/bin/jq \
67+
# Yq
68+
&& curl -sSLf "https://github.com/mikefarah/yq/releases/download/v${YQ_VERSION}/yq_linux_$(case $(dpkg --print-architecture) in "amd64") echo "amd64" ;; "arm64") echo "arm64" ;; esac)" \
69+
--output /usr/local/bin/yq \
70+
&& chmod +x /usr/local/bin/yq \
6071
# Bash completion
6172
&& install --verbose --mode 0755 --directory /etc/bash_completion.d \
6273
# Oh My Bash
@@ -75,11 +86,11 @@ RUN \
7586
apt-get --quiet update \
7687
&& apt-get --quiet --yes --no-install-recommends --verbose-versions install \
7788
openssh-client \
78-
sshpass \
79-
python3 \
8089
pipx \
90+
python3 \
8191
python3-argcomplete \
8292
shellcheck \
93+
sshpass \
8394
# Sudo
8495
&& echo "Defaults env_keep += \"PIPX_*\"" > /etc/sudoers.d/pipx \
8596
# Bash completion

.manala/docker/compose.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ services:
1111
build:
1212
context: ..
1313
dockerfile: docker/Dockerfile
14-
image: manala-ansible-path:20240913091855
14+
image: manala-ansible-path:20240916085125
1515
volumes:
1616
- ../..:${MANALA_DIR}
1717
environment:

Makefile

+29-16
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,20 @@
22

33
include .manala/Makefile
44

5+
NAMESPACE = manala
6+
COLLECTION = path
7+
VERSION = $(shell yq '.version' galaxy.yml)
8+
9+
###########
10+
# Version #
11+
###########
12+
13+
## Version - Get collection version
14+
version: SHELL := $(MANALA_DOCKER_SHELL)
15+
version:
16+
printf $(VERSION)
17+
.PHONY: version
18+
519
########
620
# Lint #
721
########
@@ -18,11 +32,11 @@ lint:
1832
# Test #
1933
########
2034

21-
## Test - Run all tests (but doc and coverage)
35+
## Test - Run all collection tests (but doc and coverage)
2236
test: test.sanity test.units test.integration
2337
.PHONY: test
2438

25-
## Test - Run sanity tests [VERBOSE]
39+
## Test - Run collection sanity tests [VERBOSE]
2640
test.sanity: SHELL := $(MANALA_DOCKER_SHELL)
2741
test.sanity:
2842
ansible-test sanity \
@@ -35,7 +49,7 @@ test.sanity:
3549
--exclude .manala/
3650
.PHONY: test.sanity
3751

38-
## Test - Run units tests [VERBOSE|COVERAGE]
52+
## Test - Run collection units tests [VERBOSE|COVERAGE]
3953
test.units: SHELL := $(MANALA_DOCKER_SHELL)
4054
test.units:
4155
ansible-test units \
@@ -47,7 +61,7 @@ test.units:
4761
--color yes
4862
.PHONY: test.units
4963

50-
## Test - Run integration tests [VERBOSE|COVERAGE]
64+
## Test - Run collection integration tests [VERBOSE|COVERAGE]
5165
test.integration: SHELL := $(MANALA_DOCKER_SHELL)
5266
test.integration:
5367
ansible-test integration \
@@ -59,20 +73,20 @@ test.integration:
5973
--color yes
6074
.PHONY: test.integration
6175

62-
## Test - Run documentation tests [VERBOSE]
76+
## Test - Run collection documentation tests [VERBOSE]
6377
test.doc: SHELL := $(MANALA_DOCKER_SHELL)
6478
test.doc:
6579
$(foreach type,module filter, \
66-
$(foreach plugin,$(shell ansible-doc --list manala.path --type $(type) | cut -d " " -f 1), \
80+
$(foreach plugin,$(shell ansible-doc --list $(NAMESPACE).$(COLLECTION) --type $(type) --json | jq --raw-output 'keys[]'), \
6781
ansible-doc \
6882
$(if $(VERBOSE), --verbose) \
6983
--type $(type) \
70-
$(plugin) && \
84+
$(plugin) > /dev/null && \
7185
) \
7286
) true
7387
.PHONY: test.doc
7488

75-
## Test - Run coverage [VERBOSE]
89+
## Test - Run collection coverage [VERBOSE]
7690
test.coverage: SHELL := $(MANALA_DOCKER_SHELL)
7791
test.coverage:
7892
ansible-test coverage xml \
@@ -89,20 +103,19 @@ test.coverage:
89103
# Build / Publish #
90104
###################
91105

92-
COLLECTION = manala-path-*.tar.gz
93-
94-
## Build - Build collection
106+
## Build - Build collection [VERBOSE]
95107
build: SHELL := $(MANALA_DOCKER_SHELL)
96108
build:
97-
rm -rfv $(COLLECTION)
98109
ansible-galaxy collection build \
99-
$(if $(VERBOSE), --verbose) \
100-
--force
110+
--output-path build \
111+
--force \
112+
$(if $(VERBOSE), --verbose)
113+
101114
.PHONY: build
102115

103-
## Collection - Publish collection
116+
## Publish - Publish collection [VERBOSE]
104117
publish: SHELL := $(MANALA_DOCKER_SHELL)
105118
publish:
106-
ansible-galaxy collection publish $(COLLECTION) \
119+
ansible-galaxy collection publish build/$(NAMESPACE)-$(COLLECTION)-$(VERSION).tar.gz \
107120
$(if $(VERBOSE), --verbose)
108121
.PHONY: publish

README.md

+7-8
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ Note that if you install the collection from Ansible Galaxy, it will not be upgr
3030
ansible-galaxy collection install manala.path --upgrade
3131
```
3232

33-
You can also install a specific version of the collection, for example, if you need to downgrade when something is broken in the latest version (please report an issue in this repository). Use the following syntax to install version `1.0.0`:
33+
You can also install a specific version of the collection, for example, if you need to downgrade when something is broken in the latest version (please report an issue in this repository). Use the following syntax to install version `1.1.0`:
3434

3535
```shell
36-
ansible-galaxy collection install manala.path:==1.0.0
36+
ansible-galaxy collection install manala.path:==1.1.0
3737
```
3838

3939
### Installing the Collection from Github
@@ -48,7 +48,7 @@ In case of unavailability of ansible-galaxy, we host a tar.gz of every version o
4848
- requirements.yaml:
4949
```yaml
5050
collections:
51-
- name: https://github.com/manala/ansible-path/releases/download/$VERSION/manala-roles-$VERSION.tar.gz
51+
- name: https://github.com/manala/ansible-path/releases/download/$VERSION/manala-path-$VERSION.tar.gz
5252
type: url
5353
```
5454

@@ -68,11 +68,10 @@ Found a bug ? Please open an [issue](https://github.com/manala/ansible-path/issu
6868

6969
You can contact us [here](manala-io.slack.com)
7070

71-
Any kind of contribution is very welcome, you can submit pull requests [here](https://github.com/manala/ansible-roles/pulls)
71+
Any kind of contribution is very welcome, you can submit pull requests [here](https://github.com/manala/ansible-path/pulls)
7272

73-
This collection uses [molecule](https://github.com/ansible-community/molecule), [ansible-lint](https://github.com/ansible-community/ansible-lint), and `ansible-test` for linting and testing roles.
73+
This collection uses [ansible-lint](https://github.com/ansible-community/ansible-lint), and `ansible-test` for linting and testing roles.
7474

75-
All of these tools are available through the excellent [ansible-toolset](https://github.com/ansible-community/toolset) docker image.
7675

7776
Open a docker shell
7877
```shell
@@ -96,8 +95,8 @@ ansible-test units --python 3.11 tests/unit/plugins/lookup/test_foo.py
9695

9796
This collection is distributed under the MIT license.
9897

99-
See [LICENSE](https://opensource.org/licenses/MIT) to see the full text.
98+
See [LICENSE](LICENSE) to see the full text.
10099

101100
# Author information
102101

103-
Manala [**(http://www.manala.io/)**](http://www.manala.io)
102+
Manala [**(https://www.manala.io/)**](https://www.manala.io/)

galaxy.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,5 +67,5 @@ build_ignore:
6767
- examples
6868
- galaxy_token
6969
- Makefile
70-
- manala-path-*
70+
- build
7171
- tests

0 commit comments

Comments
 (0)