Skip to content

Commit

Permalink
Merge branch 'main' into sm/sm-1082
Browse files Browse the repository at this point in the history
  • Loading branch information
coltonhurst authored Feb 6, 2024
2 parents ac94ce9 + 1595306 commit 4f8a6c6
Show file tree
Hide file tree
Showing 22 changed files with 1,768 additions and 54 deletions.
15 changes: 1 addition & 14 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,8 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:base",
"github>bitwarden/renovate-config:pin-actions",
":combinePatchMinorReleases",
":dependencyDashboard",
":maintainLockFilesWeekly",
":prConcurrentLimit10",
":rebaseStalePrs",
":separateMajorReleases",
"group:monorepos",
"schedule:weekends"
],
"extends": ["github>bitwarden/renovate-config:non-pinned"],
"separateMajorMinor": true,
"enabledManagers": ["cargo", "github-actions", "npm", "nuget"],
"commitMessagePrefix": "[deps]:",
"commitMessageTopic": "{{depName}}",
"packageRules": [
{
"matchManagers": ["cargo"],
Expand Down
7 changes: 1 addition & 6 deletions .github/workflows/build-cli-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ on:
paths:
- "crates/bws/**"
workflow_dispatch:
inputs:
sdk_branch:
description: "Server branch name to deploy (examples: 'master', 'rc', 'feature/sm')"
type: string
default: master
pull_request:
paths:
- ".github/workflows/build-cli-docker.yml"
Expand Down Expand Up @@ -111,7 +106,7 @@ jobs:
platforms: |
linux/amd64,
linux/arm64/v8
push: true
push: ${{ env.is_publish_branch }}
tags: ${{ steps.tag-list.outputs.tags }}
secrets: |
"GH_PAT=${{ steps.retrieve-secret-pat.outputs.github-pat-bitwarden-devops-bot-repo-scope }}"
Expand Down
85 changes: 81 additions & 4 deletions .github/workflows/release-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,19 @@ on:
release_type:
description: "Release Options"
required: true
default: "Initial Release"
default: "Release"
type: choice
options:
- Initial Release
- Redeploy
- Release
- Dry Run

defaults:
run:
shell: bash

env:
_AZ_REGISTRY: bitwardenprod.azurecr.io

jobs:
setup:
name: Setup
Expand Down Expand Up @@ -120,7 +122,7 @@ jobs:

publish:
name: Publish bws to crates.io
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
needs:
- setup
steps:
Expand Down Expand Up @@ -156,3 +158,78 @@ jobs:
PUBLISH_GRACE_SLEEP: 10
CARGO_REGISTRY_TOKEN: ${{ steps.retrieve-secrets.outputs.cratesio-api-token }}
run: cargo-release release publish -p bws --execute --no-confirm

publish-docker:
name: Publish docker versioned and latest image
runs-on: ubuntu-22.04
needs: setup
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Generate tag list
id: tag-list
env:
VERSION: ${{ needs.setup.outputs.release-version }}
DRY_RUN: ${{ inputs.release_type == 'Dry Run' }}
run: |
if [[ "${DRY_RUN}" == "true" ]]; then
REF=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}
IMAGE_TAG=$(echo "${REF}" | sed "s#/#-#g") # slash safe branch name
echo "tags=$_AZ_REGISTRY/bws:${IMAGE_TAG},bitwarden/bws:${IMAGE_TAG}" >> $GITHUB_OUTPUT
else
echo "tags=$_AZ_REGISTRY/bws:${VERSION},bitwarden/bws:${VERSION},$_AZ_REGISTRY/bws:latest,bitwarden/bws:latest" >> $GITHUB_OUTPUT
fi
########## Set up Docker ##########
- name: Set up QEMU emulators
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0

########## Login to Docker registries ##########
- name: Login to Azure - Prod Subscription
uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0
with:
creds: ${{ secrets.AZURE_PROD_KV_CREDENTIALS }}

- name: Login to Azure ACR
run: az acr login -n ${_AZ_REGISTRY%.azurecr.io}

- name: Login to Azure - CI Subscription
uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0
with:
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}

- name: Retrieve github PAT secrets
id: retrieve-secret-pat
uses: bitwarden/gh-actions/get-keyvault-secrets@main
with:
keyvault: "bitwarden-ci"
secrets: "github-pat-bitwarden-devops-bot-repo-scope"

- name: Setup Docker Trust
uses: bitwarden/gh-actions/setup-docker-trust@main
with:
azure-creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
azure-keyvault-name: "bitwarden-ci"

- name: Build and push Docker image
uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 # v5.1.0
with:
context: .
file: crates/bws/Dockerfile
platforms: |
linux/amd64,
linux/arm64/v8
push: ${{ inputs.release_type != 'Dry Run' }}
tags: ${{ steps.tag-list.outputs.tags }}
secrets: |
"GH_PAT=${{ steps.retrieve-secret-pat.outputs.github-pat-bitwarden-devops-bot-repo-scope }}"
- name: Log out of Docker and disable Docker Notary
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
run: |
docker logout
echo "DOCKER_CONTENT_TRUST=0" >> $GITHUB_ENV
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ schemas
/crates/bitwarden-napi/src-ts/bitwarden_client/schemas.ts
about.hbs
support/docs/template.hbs

# Test fixtures
crates/bitwarden-exporters/resources/*
2 changes: 2 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
"Pbkdf",
"PKCS8",
"repr",
"reprompt",
"reqwest",
"schemars",
"totp",
"uniffi",
"wordlist",
"zxcvbn"
Expand Down
34 changes: 34 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions crates/bitwarden-exporters/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[package]
name = "bitwarden-exporters"
version = "0.1.0"
authors = ["Bitwarden Inc"]
license-file = "LICENSE"
repository = "https://github.com/bitwarden/sdk"
homepage = "https://bitwarden.com"
description = """
Internal crate for the bitwarden crate. Do not use.
"""
keywords = ["bitwarden"]
edition = "2021"
rust-version = "1.57"
exclude = ["/resources"]

[dependencies]
chrono = { version = ">=0.4.26, <0.5", features = [
"clock",
"serde",
"std",
], default-features = false }
csv = "1.3.0"
serde = { version = ">=1.0, <2.0", features = ["derive"] }
serde_json = ">=1.0.96, <2.0"
thiserror = ">=1.0.40, <2.0"
uuid = { version = ">=1.3.3, <2.0", features = ["serde"] }
6 changes: 6 additions & 0 deletions crates/bitwarden-exporters/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Bitwarden Exporters

This is an internal crate for the Bitwarden SDK do not depend on this directly and use the
[`bitwarden`](https://crates.io/crates/bitwarden) crate instead.

This crate does not follow semantic versioning and the public interface may change at any time.
Loading

0 comments on commit 4f8a6c6

Please sign in to comment.