Skip to content

Commit baec2a5

Browse files
committed
Merge branch 'develop' into feature/testsSholdNotFailFast
2 parents 02d57ca + 9d98a82 commit baec2a5

13 files changed

Lines changed: 218 additions & 110 deletions

File tree

.circleci/config.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ workflows:
44
build-and-deploy:
55
jobs:
66
- build
7-
- push:
7+
- push:
88
filters:
99
tags:
10-
only: /^v.*/
10+
only: /^v.*/
1111
branches:
1212
ignore: /.*/
1313
jobs:
@@ -30,7 +30,7 @@ jobs:
3030
resource_class: large
3131
steps:
3232
- checkout
33-
- run:
33+
- run:
3434
name: semver check
3535
command: |
3636
MAJOR=$(echo ${CIRCLE_TAG#v} | cut -d"." -f1)
@@ -46,8 +46,8 @@ jobs:
4646
4747
This job uses the semver from the git TAG as the public version to publish.
4848
49-
- This should only run on workflows triggered by a tag.
50-
- The tag name should be a semver like 'v1.2.3'
49+
- This should only run on workflows triggered by a tag.
50+
- The tag name should be a semver like 'v1.2.3'
5151
- The version should follow conventions documented at https://github.com/fsaintjacques/semver-tool
5252
EOF
5353
exit 1

.github/workflows/cli.yml

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,26 @@ on:
1212

1313
jobs:
1414
build:
15-
name: Build and test ${{ matrix.os }}
15+
name: Build and test ${{ matrix.os }} ${{ matrix.arch }}
1616
runs-on: ubuntu-latest
1717
strategy:
1818
matrix:
1919
os: [linux, darwin, windows]
20+
arch: [amd64, arm64]
21+
exclude:
22+
- os: windows
23+
arch: arm64
2024
env:
2125
VAULT_VERSION: "1.1.3"
2226
VAULT_TOKEN: "root"
2327
VAULT_ADDR: "http://127.0.0.1:8200"
2428
steps:
2529
- name: Install dependencies
2630
run: sudo apt-get update && sudo apt-get install git -y
27-
- name: Set up Go 1.13
31+
- name: Set up Go 1.17
2832
uses: actions/setup-go@v2
2933
with:
30-
go-version: 1.13
34+
go-version: 1.17
3135
id: go
3236
- name: Check out code into the Go module directory
3337
uses: actions/checkout@v2
@@ -37,13 +41,24 @@ jobs:
3741
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
3842
restore-keys: |
3943
${{ runner.os }}-go-
40-
- name: Build
44+
- name: Build Linux and Darwin
45+
if: matrix.os != 'windows'
46+
run: GOOS=${{ matrix.os }} GOARCH=${{ matrix.arch }} go build -o sops-${{ matrix.os }}-${{ matrix.arch }}-${{ github.sha }} -v ./cmd/sops
47+
- name: Build Windows
48+
if: matrix.os == 'windows'
4149
run: GOOS=${{ matrix.os }} go build -o sops-${{ matrix.os }}-${{ github.sha }} -v ./cmd/sops
4250
- name: Import test GPG keys
4351
run: for i in 1 2 3 4 5; do gpg --import pgp/sops_functional_tests_key.asc && break || sleep 15; done
4452
- name: Test
4553
run: make test
46-
- name: Upload artifact
54+
- name: Upload artifact for Linux and Darwin
55+
if: matrix.os != 'windows'
56+
uses: actions/upload-artifact@v2
57+
with:
58+
name: sops-${{ matrix.os }}-${{ matrix.arch }}-${{ github.sha }}
59+
path: sops-${{ matrix.os }}-${{ matrix.arch }}-${{ github.sha }}
60+
- name: Upload artifact for Windows
61+
if: matrix.os == 'windows'
4762
uses: actions/upload-artifact@v2
4863
with:
4964
name: sops-${{ matrix.os }}-${{ github.sha }}
@@ -63,9 +78,9 @@ jobs:
6378
uses: actions/checkout@v2
6479
- uses: actions/download-artifact@v2
6580
with:
66-
name: sops-linux-${{ github.sha }}
81+
name: sops-linux-amd64-${{ github.sha }}
6782
- name: Move SOPS binary
68-
run: mv sops-linux-${{ github.sha }} ./functional-tests/sops
83+
run: mv sops-linux-amd64-${{ github.sha }} ./functional-tests/sops
6984
- name: Make SOPS binary executable
7085
run: chmod +x ./functional-tests/sops
7186
- name: Download Vault

.github/workflows/release.yml

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,15 @@ jobs:
1515
run: sudo apt-get update && sudo apt-get install git ruby rpm -y
1616
- name: Install fpm
1717
run: gem install fpm || sudo gem install fpm
18-
- name: Set up Go 1.15
18+
- name: Set up Go 1.17
1919
uses: actions/setup-go@v2
2020
with:
21-
go-version: 1.15
21+
go-version: 1.17
2222
id: go
2323
- name: Check out code into the Go module directory
2424
uses: actions/checkout@v2
25+
- name: Go vendor
26+
run: go mod vendor
2527
- name: Make release directory
2628
run: mkdir dist
2729
- name: Build deb and rpm
@@ -32,20 +34,32 @@ jobs:
3234
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
3335
- name: Set RELEASE_NUMBER
3436
run: echo "RELEASE_NUMBER=$(echo $RELEASE_VERSION | cut -c2-)" >> $GITHUB_ENV
35-
- name: Build darwin binary
36-
run: GOOS=darwin CGO_ENABLED=0 go build -mod vendor -o dist/sops-${{ env.RELEASE_VERSION }}.darwin go.mozilla.org/sops/v3/cmd/sops
37+
- name: Build linux arm64 binary
38+
run: GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -mod vendor -o dist/sops-${{ env.RELEASE_VERSION }}.linux.arm64 go.mozilla.org/sops/v3/cmd/sops
39+
- name: Build darwin amd64 binary
40+
run: GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go build -mod vendor -o dist/sops-${{ env.RELEASE_VERSION }}.darwin.amd64 go.mozilla.org/sops/v3/cmd/sops
41+
- name: Copy darwin amd64 to have a no-architecture labeled version
42+
run: cp dist/sops-${{ env.RELEASE_VERSION }}.darwin.amd64 dist/sops-${{ env.RELEASE_VERSION }}.darwin
43+
- name: Build darwin arm64 binary
44+
run: GOOS=darwin GOARCH=arm64 CGO_ENABLED=0 go build -mod vendor -o dist/sops-${{ env.RELEASE_VERSION }}.darwin.arm64 go.mozilla.org/sops/v3/cmd/sops
3745
- name: Build windows binary
3846
run: GOOS=windows CGO_ENABLED=0 go build -mod vendor -o dist/sops-${{ env.RELEASE_VERSION }}.exe go.mozilla.org/sops/v3/cmd/sops
3947
- name: Copy already built linux binary
40-
run: cp tmppkg/usr/local/bin/sops dist/sops-${{ env.RELEASE_VERSION }}.linux
48+
run: cp tmppkg/usr/local/bin/sops dist/sops-${{ env.RELEASE_VERSION }}.linux && cp tmppkg/usr/local/bin/sops dist/sops-${{ env.RELEASE_VERSION }}.linux.amd64
4149
- name: Create release
4250
uses: "mozilla/action-automatic-releases@latest"
4351
with:
4452
repo_token: "${{ secrets.GITHUB_TOKEN }}"
4553
prerelease: true
4654
files: |
4755
dist/sops-${{ env.RELEASE_VERSION }}.exe
56+
dist/sops-${{ env.RELEASE_VERSION }}.darwin.amd64
57+
dist/sops-${{ env.RELEASE_VERSION }}.darwin.arm64
4858
dist/sops-${{ env.RELEASE_VERSION }}.darwin
59+
dist/sops-${{ env.RELEASE_VERSION }}.linux.amd64
60+
dist/sops-${{ env.RELEASE_VERSION }}.linux.arm64
4961
dist/sops-${{ env.RELEASE_VERSION }}.linux
5062
dist/sops_${{ env.RELEASE_NUMBER }}_amd64.deb
63+
dist/sops_${{ env.RELEASE_NUMBER }}_arm64.deb
5164
dist/sops-${{ env.RELEASE_NUMBER }}-1.x86_64.rpm
65+
dist/sops-${{ env.RELEASE_NUMBER }}-1.aarch64.rpm

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
FROM golang:1.15
1+
FROM golang:1.17
22

33
COPY . /go/src/go.mozilla.org/sops
44
WORKDIR /go/src/go.mozilla.org/sops
55

66
RUN CGO_ENABLED=1 make install
77
RUN apt-get update
8-
RUN apt-get install -y vim python-pip emacs
8+
RUN apt-get install -y vim python3-pip emacs
99
RUN pip install awscli
1010
ENV EDITOR vim

Dockerfile.alpine

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
FROM golang:1.12-alpine3.10 AS builder
2+
FROM golang:1.17-alpine3.15 AS builder
23

34
RUN apk --no-cache add make
45

@@ -8,7 +9,7 @@ WORKDIR /go/src/go.mozilla.org/sops
89
RUN CGO_ENABLED=1 make install
910

1011

11-
FROM alpine:3.10
12+
FROM alpine:3.15
1213

1314
RUN apk --no-cache add \
1415
vim ca-certificates

Makefile

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
44

55
PROJECT := go.mozilla.org/sops/v3
6-
GO := GO15VENDOREXPERIMENT=1 GO111MODULE=on GOPROXY=https://proxy.golang.org go
6+
GO := GOPROXY=https://proxy.golang.org go
77
GOLINT := golint
88

99
all: test vet generate install functional-tests
@@ -48,31 +48,47 @@ functional-tests-all:
4848
$(GO) build -o functional-tests/sops go.mozilla.org/sops/v3/cmd/sops
4949
cd functional-tests && cargo test && cargo test -- --ignored
5050

51-
deb-pkg: vendor
51+
# Creates variables during target re-definition. Basically this block allows the particular variables to be used in the final target
52+
build-deb-%: OS = $(word 1,$(subst -, ,$*))
53+
build-deb-%: ARCH = $(word 2,$(subst -, ,$*))
54+
build-deb-%: FPM_ARCH = $(word 3,$(subst -, ,$*))
55+
# Poor-mans function with parameters being split out from the variable part of it's name
56+
build-deb-%:
5257
rm -rf tmppkg
5358
mkdir -p tmppkg/usr/local/bin
54-
GOOS=linux CGO_ENABLED=0 go build -mod vendor -o tmppkg/usr/local/bin/sops go.mozilla.org/sops/v3/cmd/sops
59+
GOOS=$(OS) GOARCH="$(ARCH)" CGO_ENABLED=0 go build -mod vendor -o tmppkg/usr/local/bin/sops go.mozilla.org/sops/v3/cmd/sops
5560
fpm -C tmppkg -n sops --license MPL2.0 --vendor mozilla \
5661
--description "Sops is an editor of encrypted files that supports YAML, JSON and BINARY formats and encrypts with AWS KMS and PGP." \
5762
-m "AJ Bahnken <ajvb+sops@mozilla.com>" \
5863
--url https://go.mozilla.org/sops \
59-
--architecture x86_64 \
64+
--architecture $(FPM_ARCH) \
6065
-v "$$(grep '^const Version' version/version.go |cut -d \" -f 2)" \
6166
-s dir -t deb .
6267

63-
rpm-pkg: vendor
68+
# Create .deb packages for multiple architectures
69+
deb-pkg: vendor build-deb-linux-amd64-x86_64 build-deb-linux-arm64-arm64
70+
71+
# Creates variables during target re-definition. Basically this block allows the particular variables to be used in the final target
72+
build-rpm-%: OS = $(word 1,$(subst -, ,$*))
73+
build-rpm-%: ARCH = $(word 2,$(subst -, ,$*))
74+
build-rpm-%: FPM_ARCH = $(word 3,$(subst -, ,$*))
75+
# Poor-mans function with parameters being split out from the variable part of it's name
76+
build-rpm-%:
6477
rm -rf tmppkg
6578
mkdir -p tmppkg/usr/local/bin
66-
GOOS=linux CGO_ENABLED=0 go build -mod vendor -o tmppkg/usr/local/bin/sops go.mozilla.org/sops/v3/cmd/sops
79+
GOOS=$(OS) GOARCH="$(ARCH)" CGO_ENABLED=0 go build -mod vendor -o tmppkg/usr/local/bin/sops go.mozilla.org/sops/v3/cmd/sops
6780
fpm -C tmppkg -n sops --license MPL2.0 --vendor mozilla \
6881
--description "Sops is an editor of encrypted files that supports YAML, JSON and BINARY formats and encrypts with AWS KMS and PGP." \
6982
-m "AJ Bahnken <ajvb+sops@mozilla.com>" \
7083
--url https://go.mozilla.org/sops \
71-
--architecture x86_64 \
72-
--rpm-os linux \
84+
--architecture $(FPM_ARCH) \
85+
--rpm-os $(OS) \
7386
-v "$$(grep '^const Version' version/version.go |cut -d \" -f 2)" \
7487
-s dir -t rpm .
7588

89+
# Create .rpm packages for multiple architectures
90+
rpm-pkg: vendor build-rpm-linux-amd64-x86_64 build-rpm-linux-arm64-arm64
91+
7692
dmg-pkg: install
7793
ifneq ($(OS),darwin)
7894
echo 'you must be on MacOS and set OS=darwin on the make command line to build an OSX package'
@@ -82,7 +98,7 @@ else
8298
cp $$GOPATH/bin/sops tmppkg/usr/local/bin/
8399
fpm -C tmppkg -n sops --license MPL2.0 --vendor mozilla \
84100
--description "Sops is an editor of encrypted files that supports YAML, JSON and BINARY formats and encrypts with AWS KMS and PGP." \
85-
-m "Julien Vehent <jvehent+sops@mozilla.com>" \
101+
-m "Mozilla Security <security@mozilla.org>" \
86102
--url https://go.mozilla.org/sops \
87103
--architecture x86_64 \
88104
-v "$$(grep '^const Version' version/version.go |cut -d \" -f 2)" \

README.rst

Lines changed: 15 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,8 @@ formats and encrypts with AWS KMS, GCP KMS, Azure Key Vault, age, and PGP.
99

1010
------------
1111

12-
.. image:: https://godoc.org/go.mozilla.org/sops?status.svg
13-
:target: https://godoc.org/go.mozilla.org/sops
14-
15-
.. image:: https://travis-ci.org/mozilla/sops.svg?branch=master
16-
:target: https://travis-ci.org/mozilla/sops
12+
.. image:: https://pkg.go.dev/badge/go.mozilla.org/sops/v3.svg
13+
:target: https://pkg.go.dev/go.mozilla.org/sops/v3
1714

1815
Download
1916
--------
@@ -28,12 +25,13 @@ For the adventurous, unstable features are available in the `develop` branch, wh
2825

2926
.. code:: bash
3027
31-
$ go get -u go.mozilla.org/sops/v3/cmd/sops
28+
$ mkdir -p $GOPATH/src/go.mozilla.org/sops/
29+
$ git clone https://github.com/mozilla/sops.git $GOPATH/src/go.mozilla.org/sops/
3230
$ cd $GOPATH/src/go.mozilla.org/sops/
3331
$ git checkout develop
3432
$ make install
3533
36-
(requires Go >= 1.13)
34+
(requires Go >= 1.17)
3735

3836
If you don't have Go installed, set it up with:
3937

@@ -46,12 +44,7 @@ If you don't have Go installed, set it up with:
4644
4745
Or whatever variation of the above fits your system and shell.
4846

49-
To use **sops** as a library, take a look at the `decrypt package <https://godoc.org/go.mozilla.org/sops/decrypt>`_.
50-
51-
**What happened to Python Sops?** We rewrote Sops in Go to solve a number of
52-
deployment issues, but the Python branch still exists under ``python-sops``. We
53-
will keep maintaining it for a while, and you can still ``pip install sops``,
54-
but we strongly recommend you use the Go version instead.
47+
To use **sops** as a library, take a look at the `decrypt package <https://pkg.go.dev/go.mozilla.org/sops/v3/decrypt>`_.
5548

5649
.. sectnum::
5750
.. contents:: Table of Contents
@@ -197,6 +190,8 @@ configuration directory. On Linux, this would be ``$XDG_CONFIG_HOME/sops/age/key
197190
On macOS, this would be ``$HOME/Library/Application Support/sops/age/keys.txt``. On
198191
Windows, this would be ``%AppData%\sops\age\keys.txt``. You can specify the location
199192
of this file manually by setting the environment variable **SOPS_AGE_KEY_FILE**.
193+
Alternatively you can provide the the key(s) directly by setting the **SOPS_AGE_KEY**
194+
environment variable.
200195

201196
The contents of this key file should be a list of age X25519 identities, one
202197
per line. Lines beginning with ``#`` are considered comments and ignored. Each
@@ -704,12 +699,6 @@ By default, ``sops`` uses the key server ``keys.openpgp.org`` to retrieve the GP
704699
keys that are not present in the local keyring.
705700
This is no longer configurable. You can learn more about why from this write-up: `SKS Keyserver Network Under Attack <https://gist.github.com/rjhansen/67ab921ffb4084c865b3618d6955275f>`_.
706701
707-
Example: place the following in your ``~/.bashrc``
708-
709-
.. code:: bash
710-
711-
SOPS_GPG_KEYSERVER = 'gpg.example.com'
712-
713702
714703
Key groups
715704
~~~~~~~~~~
@@ -1207,7 +1196,7 @@ This file will not work in sops:
12071196
- array
12081197
- elements
12091198
1210-
But this one will because because the ``sops`` key can be added at the same level as the
1199+
But this one will work because the ``sops`` key can be added at the same level as the
12111200
``data`` key.
12121201
12131202
.. code:: yaml
@@ -1374,26 +1363,6 @@ The value must be formatted as json.
13741363
13751364
$ sops --set '["an_array"][1] {"uid1":null,"uid2":1000,"uid3":["bob"]}' ~/git/svc/sops/example.yaml
13761365
1377-
Using sops as a library in a python script
1378-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1379-
1380-
You can import sops as a module and use it in your python program.
1381-
1382-
.. code:: python
1383-
1384-
import sops
1385-
1386-
pathtype = sops.detect_filetype(path)
1387-
tree = sops.load_file_into_tree(path, pathtype)
1388-
sops_key, tree = sops.get_key(tree)
1389-
tree = sops.walk_and_decrypt(tree, sops_key)
1390-
sops.write_file(tree, path=path, filetype=pathtype)
1391-
1392-
Note: this uses the previous implementation of `sops` written in python,
1393-
1394-
and so doesn't support newer features such as GCP-KMS.
1395-
To use the current version, call out to ``sops`` using ``subprocess.run``
1396-
13971366
Showing diffs in cleartext in git
13981367
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
13991368
@@ -1709,8 +1678,8 @@ file format introduced in **1.0**.
17091678
Security
17101679
--------
17111680
1712-
Please report security issues to jvehent at mozilla dot com, or by using one
1713-
of the contact method available on keybase: `https://keybase.io/jvehent <https://keybase.io/jvehent>`_
1681+
Please report security issues to security at mozilla dot org, or by using one
1682+
of the contact method available here: `https://www.mozilla.org/en-US/security/#For_Developers <https://www.mozilla.org/en-US/security/#For_Developers>`_
17141683
17151684
License
17161685
-------
@@ -1721,9 +1690,12 @@ Authors
17211690
17221691
The core team is composed of:
17231692
1693+
* AJ Banhken @ajvb
1694+
1695+
The original authors were:
1696+
17241697
* Adrian Utrilla @autrilla
17251698
* Julien Vehent @jvehent
1726-
* AJ Banhken @ajvb
17271699
17281700
And a whole bunch of `contributors <https://github.com/mozilla/sops/graphs/contributors>`_
17291701

0 commit comments

Comments
 (0)