Skip to content

Commit

Permalink
Merge pull request #5 from hashicorp/dev
Browse files Browse the repository at this point in the history
Releasing 0.1.5
  • Loading branch information
Christian Frichot authored Jan 6, 2021
2 parents 61708b8 + 29ddc3e commit 62cfbd5
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 68 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ parameters:
default: "vault_selinux"
hc-version:
type: string
default: "0.1.4"
default: "0.1.5"
hc-package-iteration:
type: string
default: "1"
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## 0.1.5
### Jan 6th, 2021

CHANGES:

* Simplified local testing with the `local-package` Makefile target

## 0.1.4
### Nov 17th, 2020

Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ default: help
package :
cd products/${HC_PRODUCT} && ./package.sh

.PHONY : local-package
local-package :
cd products/vault_selinux && HC_VERSION=0.0.1 LOCAL_PACKAGE=1 ./package.sh

.PHONY : help
help :
@echo "Placeholder for help output"
50 changes: 3 additions & 47 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,56 +75,12 @@ These jobs will save RPM artifacts in the package steps, one for CentOS, and one

This has only been tested on CentOS and Fedora, and requires some pre-requisites. The AWS steps below offer a more thorough example of how to test this on CentOS and Fedora.

### CentOS
First, clone this repo.

Install Vault:
Then:

```sh
sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo
sudo yum -y install vault
```

Install SELinux Policy development pre-requisites:

```sh
sudo yum -y install policycoreutils-devel setools-console rpm-build selinux-policy-devel selinux-policy-targeted
```

Clone this repo, update versions, then run the `vault.sh` script.

```sh
cd products/vault_selinux
sed -i "s^#VERSION#^0.1.1^g" vault.te
sed -i "s^#VERSION#^0.1.1^g" vault_selinux.spec
sudo ./vault.sh
```

To re-install, after making changes to the SELinux files, you can re-run this script.

### Fedora

Install Vault:

```sh
sudo dnf install -y dnf-plugins-core
sudo dnf config-manager --add-repo https://rpm.releases.hashicorp.com/fedora/hashicorp.repo
sudo dnf -y install vault
```

Install SELinux Policy development pre-requisites:

```sh
sudo dnf -y install policycoreutils-devel setools-console rpm-build
```

Clone this repo, update versions, then run the `vault.sh` script.

```sh
cd products/vault_selinux
sed -i "s^#VERSION#^0.1.1^g" vault.te
sed -i "s^#VERSION#^0.1.1^g" vault_selinux.spec
sudo ./vault.sh
sudo make local-package
```

To re-install, after making changes to the SELinux files, you can re-run this script.
Expand Down
50 changes: 31 additions & 19 deletions products/vault_selinux/package.sh
Original file line number Diff line number Diff line change
@@ -1,24 +1,32 @@
#!/usr/bin/env bash
set -xeu pipefail

VERSION=${HC_VERSION}
HC_VERSION=${HC_VERSION}
PACKAGE_ITERATION=${HC_PACKAGE_ITERATION:-1}
LOCAL=${LOCAL_PACKAGE:-0}

PRODUCT_NAME="vault_selinux"

OUTPUT_PATH=$(pwd)
# Create temporary workspace
echo "Creating temporary workspace"
mkdir pkg_tmp

cp ./vault.fc ./pkg_tmp/vault.fc
cp ./vault.if ./pkg_tmp/vault.if
cp ./vault.sh ./pkg_tmp/vault.sh
cp ./vault.te ./pkg_tmp/vault.te
cp ./vault_selinux.spec ./pkg_tmp/vault_selinux.spec

PACKAGE_DIR=$(cd pkg_tmp; pwd)
cd $PACKAGE_DIR
if [[ "$LOCAL" == "1" ]]; then
echo "Performing a local package install"
HC_VERSION="0.0.1"
else
# Create temporary workspace
echo "Performing CI package install"
echo "Creating temporary workspace"
mkdir pkg_tmp

cp ./vault.fc ./pkg_tmp/vault.fc
cp ./vault.if ./pkg_tmp/vault.if
cp ./vault.sh ./pkg_tmp/vault.sh
cp ./vault.te ./pkg_tmp/vault.te
cp ./vault_selinux.spec ./pkg_tmp/vault_selinux.spec

PACKAGE_DIR=$(cd pkg_tmp; pwd)
cd $PACKAGE_DIR
fi

# @TODO: I'm sure there are better ways to build RPM packages for Fedora & Centos
# Currently I'm doing this in two different containers, with some %if logic in the
Expand Down Expand Up @@ -66,10 +74,14 @@ sed -i "s^#VERSION#^${HC_VERSION}^g" vault.te
sed -i "s^#VERSION#^${HC_VERSION}^g" vault_selinux.spec

# Run the sepolicy builder
sh ./vault.sh
cp *.rpm $OUTPUT_PATH
cp noarch/*.rpm $OUTPUT_PATH

# Cleanup
cd $OUTPUT_PATH
rm -rf $PACKAGE_DIR
if [[ "$LOCAL" == "1" ]]; then
sudo sh ./vault.sh
else
sh ./vault.sh
cp *.rpm $OUTPUT_PATH
cp noarch/*.rpm $OUTPUT_PATH

# Cleanup
cd $OUTPUT_PATH
rm -rf $PACKAGE_DIR
fi
5 changes: 4 additions & 1 deletion products/vault_selinux/vault_selinux.spec
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,10 @@ exit 0


%changelog
* Tue Nov 17 2020 Christian Frichot <cfrichot@hashicorp> 0.1.4-1
* Wed Jan 6 2021 Christian Frichot <[email protected]> 0.1.5-1
- Simplified local-package Makefile target

* Tue Nov 17 2020 Christian Frichot <[email protected]> 0.1.4-1
- Packaging for Centos7, Centos8, Fedora31, Fedora32, Fedora33

* Thu Nov 12 2020 Christian Frichot <[email protected]> 0.1.3-1
Expand Down

0 comments on commit 62cfbd5

Please sign in to comment.