-
Notifications
You must be signed in to change notification settings - Fork 0
ci: build inside a nix develop shell with just #19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| has nix && use flake | ||
| watch_file *.nix | ||
| dotenv_if_exists .env # You can create a .env file with your env vars for this project. You can also use .secrets if you are using act. See the line below. | ||
| dotenv_if_exists .secrets # Used by [act](https://nektosact.com/) to load secrets into the pipelines |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| { | ||
| inputs = { | ||
| nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; | ||
| flake-utils.url = "github:numtide/flake-utils"; | ||
| }; | ||
| outputs = | ||
| { | ||
| self, | ||
| nixpkgs, | ||
| flake-utils, | ||
| }: | ||
| flake-utils.lib.eachDefaultSystem ( | ||
| system: | ||
| let | ||
| pkgs = import nixpkgs { | ||
| inherit system; | ||
| config.allowUnfree = true; | ||
| overlays = [ self.overlays.default ]; | ||
| }; | ||
| in | ||
| { | ||
| packages.tfx-cli = pkgs.tfx-cli; | ||
|
|
||
| devShells.default = | ||
| with pkgs; | ||
| mkShell { | ||
| packages = [ | ||
| azure-cli | ||
| curl | ||
| git | ||
| jq | ||
| just | ||
| nodejs_22 | ||
| pinact | ||
| sd | ||
| tfx-cli | ||
| typescript | ||
| ]; | ||
| }; | ||
|
|
||
| formatter = pkgs.nixfmt-tree; | ||
| } | ||
| ) | ||
| // { | ||
| overlays.default = final: prev: { | ||
| tfx-cli = final.callPackage ./nix/tfx-cli.nix { }; | ||
| }; | ||
| }; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| typescript_source := justfile_directory() / "sysdig-cli-scan-task" | ||
| azure_devops_access_token := env_var_or_default("AZURE_DEVOPS_ACCESS_TOKEN", "") | ||
|
|
||
| # List available recipes | ||
| default: | ||
| @just --list | ||
|
|
||
| # Install deps and compile the TypeScript task | ||
| build: | ||
| npm install | ||
| cd {{typescript_source}} && npm install && tsc | ||
|
|
||
| # Publish a test build shared with the sysdigtest org | ||
| publish-local: build | ||
| tfx extension publish \ | ||
| --manifest-globs vss-extension-test.json \ | ||
| --publisher IgorEulalio \ | ||
| --extension-id b52fe4a2-0476-4973-bc50-cc44e9032e11 \ | ||
| --share-with sysdigtest \ | ||
| --token {{azure_devops_access_token}} | ||
|
|
||
| # Publish the release build to the marketplace | ||
| publish-release: | ||
| tfx extension publish \ | ||
| --manifest-globs {{justfile_directory()}}/vss-extension.json \ | ||
| --overrides-file {{justfile_directory()}}/vss-extension-release.json \ | ||
| --token {{azure_devops_access_token}} | ||
|
|
||
| # Pin GitHub Actions to commit SHAs | ||
| pin-actions: | ||
| pinact run -u | ||
|
|
||
| # Update everything: flake inputs, tfx-cli, and pinned actions | ||
| update: | ||
| nix flake update | ||
| nix develop --command just update-tfx | ||
| nix develop --command just pin-actions | ||
|
|
||
| # Bump tfx-cli to the latest upstream commit and recompute its hashes | ||
| update-tfx: | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
| rev="$(git ls-remote https://github.com/Microsoft/tfs-cli HEAD | cut -f1)" | ||
| version="$(curl -fsSL "https://raw.githubusercontent.com/Microsoft/tfs-cli/${rev}/package.json" | jq -r .version)" | ||
| sd 'rev = ".*";' "rev = \"${rev}\";" nix/tfx-cli.nix | ||
| sd 'version = ".*";' "version = \"${version}\";" nix/tfx-cli.nix | ||
| just rehash-tfx | ||
| echo "tfx-cli -> ${version} (${rev})" | ||
|
|
||
| # Recompute the source and npm hashes in nix/tfx-cli.nix | ||
| rehash-tfx: | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
| rehash() { | ||
| local key="$1" old new | ||
| old="$(grep -oE "${key} = \"[^\"]*\"" nix/tfx-cli.nix | head -1)" | ||
| sd "${key} = \".*\";" "${key} = \"\";" nix/tfx-cli.nix | ||
| new="$( (nix build -L --no-link .#tfx-cli || true) 2>&1 | sed -nE 's/.*got:[[:space:]]+([^ ]+).*/\1/p' | tail -1)" | ||
| if [ -z "${new}" ]; then | ||
| sd "${key} = \".*\";" "${old};" nix/tfx-cli.nix | ||
| echo "error: could not parse a new ${key}; restored previous value" >&2 | ||
| exit 1 | ||
| fi | ||
| sd "${key} = \"\";" "${key} = \"${new}\";" nix/tfx-cli.nix | ||
| echo "${key} -> ${new}" | ||
| } | ||
| rehash hash | ||
| rehash npmDepsHash |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.